#include "locmin.h"
#include <bits/stdc++.h>
using namespace std;
std::pair <int, int> find_locmin_point(int N, int M) {
    if (N == 1) {
        int l = 1; r = M;
        while (l < r-1) {
            int mid = (l + r) / 2;
            long long x=value(1, mid);
            long long y=value(1, mid-1);
            if (y < x) {
                r = mid;
            }
            else {
                long long y = value(1, mid +1);
                if (y > x) {
                    return { 1, mid};
                }
                l = mid;
            }
        }
        if (l == 1) return 1;
        return r;
    }
}
