#include <bits/stdc++.h>
using namespace std;
int dx[8] = {0, 0, 1, -1, 1, 1, -1, -1};
int dy[8] = {1, -1, 0, 0, 1, -1, 1, -1};
template <typename T>
inline T BigMod(T A, T B) {
  T ret = 1;
  while (B) {
    if (B & 1) ret = (ret * A) % 1000000007;
    A = (A * A) % 1000000007;
    B = B >> 1;
  }
  return ret;
}
template <typename T>
inline T InvMod(T A, T M = 1000000007) {
  return BigMod(A, M - 2);
}
string tostring(long long int res) {
  string curstr = "";
  while (res != 0) {
    long long int temp = (res % 10);
    curstr += ((char)temp + '0');
    res /= 10;
  }
  reverse(curstr.begin(), curstr.end());
  return curstr;
}
long long int toint(string ss) {
  long long int inss = 0;
  for (int i = 0; i < ss.size(); i++) {
    inss = (inss * 10) + ((int)(ss[i] - '0'));
  }
  return inss;
}
long long int ar[100005];
struct ST {
  long long int rest, ind;
  bool operator<(const ST& x) const { return rest < x.rest; }
};
vector<ST> vv;
int main() {
  long long int n, k, temp;
  scanf("%lld %lld", &n, &k);
  ST get;
  for (int i = 0; i < k; i++) {
    scanf("%lld", &temp);
    ar[i] = temp;
    get.rest = ar[i];
    get.ind = i;
    vv.push_back(get);
  }
  sort(vv.begin(), vv.end());
  long long int res, rest = 2e18 + 5, ans;
  for (int i = 0; i < vv.size(); i++) {
    long long int now = n % vv[i].rest;
    if (now < rest) {
      rest = now;
      res = vv[i].ind + 1;
      ans = n / vv[i].rest;
    }
  }
  cout << res << " " << ans << endl;
  return 0;
}
