#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  queue<pair<int, int>> ans;
  for (int i = 0; i < n; i++) {
    int temp;
    cin >> temp;
    ans.push(make_pair(temp, i + 1));
  }
  while (ans.size() > 1) {
    pair<int, int> check = ans.front();
    if (check.first <= m)
      ans.pop();
    else {
      ans.pop();
      check.first = check.first - m;
      ans.push(check);
    }
  }
  cout << ans.front().second;
  return 0;
}
