#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, i, j = 0, t, res;
  cin >> n >> m;
  vector<pair<int, int>> arr;
  for (i = 0; i < n; i++) {
    cin >> t;
    arr.push_back(make_pair(t, i));
  }
  i = 0;
  while (n + i > j) {
    if (arr[j].first > m) {
      arr.push_back(make_pair(arr[j].first - m, arr[j].second));
      i++;
    } else
      res = arr[j].second + 1;
    j++;
  }
  cout << res;
  return 0;
}
