#include <bits/stdc++.h>
using namespace std;
class mycomp {
 public:
  bool operator()(const int &lhs, const int &rhs) { return (lhs > rhs); }
};
long long int modex(long long int a, long long int b, long long int c) {
  long long int ans = 1;
  while (b != 0) {
    if (b % 2 == 1) ans = (ans * a) % c;
    a = (a * a) % c;
    b /= 2;
  }
  return ans;
}
long long int gcd(long long int a, long long int b) {
  if (a % b == 0) {
    return b;
  } else {
    return gcd(b, a % b);
  }
}
bool isprime[100005];
void sieve(int n) {
  for (int i = 0; i <= n; i++) {
    isprime[i] = true;
  }
  isprime[0] = false;
  isprime[1] = false;
  for (int i = 2; i * i <= n; i++) {
    if (isprime[i]) {
      for (int j = i * i; j <= n; j += i) isprime[j] = false;
    }
  }
  for (int i = 0; i <= n; i++) {
    if (isprime[i]) {
      cout << i << " ";
    }
  }
  cout << endl;
}
void code() {
  long long int n, k, x, ans, ind;
  cin >> n >> k;
  long long int mn = n + 1;
  ind = -1;
  ans = 0;
  for (int i = 0; i < k; i++) {
    cin >> x;
    if (n % x < mn) {
      mn = n % x;
      ans = n / x;
      ind = i + 1;
    }
  }
  cout << ind << " " << ans << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  while (t--) {
    code();
  }
  return 0;
}
