#include <bits/stdc++.h>
using namespace std;
long long n, a[100005];
int k;
int main() {
  scanf("%I64d%d", &n, &k);
  long long mn = 1000000000000000007;
  int ans = 0;
  for (int i = 1; i <= k; i++) {
    scanf("%I64d", &a[i]);
    long long re = n % a[i];
    if (mn > re) mn = re, ans = i;
  }
  printf("%d %I64d\n", ans, n / a[ans]);
  return 0;
}
