#include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool chkmin(T& x, T y) {
  return x > y ? x = y, true : false;
}
template <class T>
inline bool chkmax(T& x, T y) {
  return x < y ? x = y, true : false;
}
inline long long read(void) {
  long long x, f = 1;
  char ch = getchar();
  for (; !isdigit(ch); ch = getchar())
    if (ch == '-') f = -1;
  for (x = 0; isdigit(ch); ch = getchar()) x = x * 10 + ch - '0';
  return x * f;
}
long long k, n, x, kk, nk, ans, ans1;
int main(void) {
  k = read();
  n = read();
  for (int i = (1); i <= (n); ++i) {
    x = read();
    kk = k - k % x;
    if (kk > nk) {
      nk = kk;
      ans = i;
      ans1 = x;
    }
  }
  if (ans1 != 0)
    cout << ans << ' ' << k / ans1 << endl;
  else
    puts("1 0");
  return 0;
}
