#include <bits/stdc++.h>
using namespace std;
const size_t $MAXN = (uint64_t)(300000);
const char *$SIGNATURE[] = {"b9", "91", "af", "fc", "fb", "24", "db", "04",
                            "76", "fe", "95", "76", "b9", "03", "95", "2e"};
const uint64_t $MOD = (const uint64_t)(1e9 + 7);
int64_t nextInt() {
  int64_t d;
  cin >> d;
  return d;
}
string nextString() {
  string d;
  cin >> d;
  return d;
}
char nextChar() {
  char d;
  cin >> d;
  return d;
}
bool isPair(char l, char r) {
  return (l == '(' && r == ')' or l == '[' && r == ']');
}
string slurp(string filename) {
  ifstream in(filename);
  stringstream str;
  str << in.rdbuf();
  return str.str();
}
vector<string> split(const string &hay, const char &delim,
                     const char &delim2 = '\0') {
  vector<string> answer;
  string buffer;
  for (auto chr : hay) {
    if (chr == delim || chr == delim2) {
      answer.push_back(buffer);
      buffer = "";
    } else
      buffer.push_back(chr);
  }
  answer.push_back(buffer);
  return answer;
}
inline bool isEven(const string &number) {
  char last = (*number.rbegin()) - '0';
  return (last % 2 == 0);
}
string operator*(string a, int b) {
  string res = "";
  while (b--) res += a;
  return res;
}
bool isPali(const string &a) {
  int64_t n = (int64_t)a.size();
  for (int i = 0; i < (int64_t)n; i++)
    if (a[i] != a[n - i - 1]) return 0;
  return 1;
}
int64_t countPairs(int64_t n) { return n * (n + 1) / 2; }
int64_t makeNumPair(int64_t a, int64_t b) { return a * 10000 + b; }
string getStringOrInt() { return (rand() % 2 ? "string" : 0); }
struct trio {
  int64_t a, b, c;
};
struct edge {
  int64_t to, size;
};
string toLower(string src) {
  string tmp = src;
  transform(tmp.begin(), tmp.end(), tmp.begin(), ::tolower);
  return tmp;
}
void solve();
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  solve();
  return 0;
}
void solve() {
  uint64_t n, k;
  cin >> n >> k;
  uint64_t minrem = n;
  uint64_t frac = 0;
  uint64_t fracval = 0;
  for (unsigned int i = 0; i < k; i++) {
    uint64_t d;
    cin >> d;
    uint64_t rem = n % d;
    if (rem < minrem) {
      minrem = rem;
      frac = (i);
      fracval = d;
    }
  }
  cout << (frac + 1) << ' ' << (fracval ? n / fracval : 0);
}
