#include <bits/stdc++.h>
const long long MOD = 1e9 + 7;
using namespace std;
int main(int argc, char const *argv[]) {
  queue<pair<long long, long long>> dq;
  long long n, m, x;
  cin >> n >> m;
  for (long long i = 0; i < n; i++) cin >> x, dq.push({x, i});
  while (dq.size() != 1) {
    auto y = dq.front();
    dq.pop();
    long long z = y.first - m;
    if (z > 0) dq.push({z, y.second});
  }
  cout << dq.front().second + 1;
}
