#include <bits/stdc++.h>
using namespace std;
void c_p_c() {}
long long isPrime(long long n) {
  for (long long i = 2; i * i <= n; i++) {
    if (n % i == 0) return 0;
  }
  return 1;
}
long long mex(long long a[], long long n) {
  set<long long> h;
  for (long long i = 0; i < n; i++) h.insert(a[i]);
  long long ans = 0;
  for (auto d : h) {
    if (d == ans) ans++;
  }
  return ans;
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  c_p_c();
  long long n, k;
  cin >> n >> k;
  long long a[k];
  long long left = 1e18;
  long long type = 1;
  long long q = 0;
  for (long long i = 0; i < k; i++) {
    cin >> a[i];
    if (a[i] > n)
      continue;
    else {
      if (n % a[i] < left) {
        left = n % a[i];
        type = i + 1;
        q = n / a[i];
      }
    }
  }
  cout << type << " " << q << '\n';
}
