#include <bits/stdc++.h>
using namespace std;
int main() {
  long long k, n;
  cin >> n >> k;
  long long ip;
  vector<long long> v, m;
  for (long long i = 0; i < k; i++) {
    cin >> ip;
    v.push_back(ip);
  }
  long long minm = n % v[0], x = 1;
  for (long long i = 1; i < k; i++) {
    if (n % v[i] < minm) {
      minm = n % v[i];
      x = i + 1;
    }
  }
  cout << x << " " << n / v[x - 1];
  return 0;
}
