#include <bits/stdc++.h>
using namespace std;
const int maxm = 100006;
const long long INF = 1e18 + 7;
int p[maxm];
int main() {
  int i, j, sum, m, id;
  long long ans = INF, x, n, s;
  scanf("%lld%d", &n, &m);
  for (i = 1; i <= m; i++) {
    scanf("%lld", &x);
    if (n % x < ans) ans = n % x, id = i, s = n / x;
  }
  printf("%d %lld\n", id, s);
  return 0;
}
