#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  queue<pair<int, int>> q;
  for (int i = 1; i <= n; i++) {
    int x;
    cin >> x;
    q.push({x, i});
  }
  int pos = 0;
  while (q.size()) {
    auto cur = q.front();
    pos = cur.second;
    q.pop();
    if (cur.first > m) q.push({cur.first - m, pos});
  }
  cout << pos << endl;
  return 0;
}
