#include <bits/stdc++.h>
using namespace std;

long long value(int r, int c);

struct Gridrememberer {
    Gridrememberer(int n, int m) : size(n, vector<long long>(m, -1)){}

    long long get_value(int n, int m) {
        if (size[n][m] != -1) {
            return size[n][m];
        }

        return size[n][m] = value(n, m);
    }

    vector<vector<long long>> size;
};

std::pair<int, int> find_locmin_point(int n, int m) {
    Gridrememberer grid(n, m);
    
    int mi = 0;
    int ma = m + 1;

    while (mi + 1 < ma) {
        int mid = (mi + ma) / 2;

        if (grid.get_value(0, mid - 1) < grid.get_value(0, mid)) {
            ma = mid;
        } else {
            mi = mid;
        }
    }

    return {0, mi};
}