#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  long long N;
  int K;
  cin >> N >> K;
  if (N == 0) {
    cout << 1 << " " << 0 << endl;
    return 0;
  }
  long long a;
  long long trueNumber;
  long long number;
  long long hams;
  long long maxH = -1;
  int type;
  for (int i = 0; i < K; i++) {
    cin >> a;
    number = N / a;
    hams = number * a;
    if (hams > maxH) {
      maxH = hams;
      trueNumber = number;
      type = i + 1;
    }
  }
  cout << type << " " << trueNumber << endl;
  return 0;
}
