#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n;
  if (n == 0) {
    cout << 1 << " " << 0 << endl;
    return 0;
  }
  long long int k;
  cin >> n >> k;
  long long int arr[k + 7];
  long long int pos = 0;
  long long cnt = 0;
  for (int i = 1; i <= k; i++) cin >> arr[i];
  long long int min = 1000000000000000000;
  for (int i = 1; i <= k; i++) {
    long long int ass = n % arr[i];
    if (min > ass) {
      min = ass;
      pos = i;
      cnt = n / arr[i];
    }
  }
  cout << pos << " " << cnt;
}
