#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
using pii = pair<int, int>;
const int N = 256;
vector<pii> fst[N], snd[N], mrg[N];
int n, k, ant;
void merj(int lvl) {
  int i, j, la, lb, mxh;
  mxh = -1;
  la = fst[lvl].size();
  lb = snd[lvl].size();
  for (i = la - 1, j = lb - 1; i >= 0 && j >= 0;) {
    if (fst[lvl][i] > snd[lvl][j]) {
      if (fst[lvl][i].second > mxh) {
        mrg[lvl].push_back(fst[lvl][i]);
        mxh = fst[lvl][i].second;
      }
      --i;
    } else {
      if (snd[lvl][j].second > mxh) {
        mrg[lvl].push_back(snd[lvl][j]);
        mxh = snd[lvl][j].second;
      }
      --j;
    }
  }
  for (; i >= 0; --i)
    if (fst[lvl][i].second > mxh) {
      mrg[lvl].push_back(fst[lvl][i]);
      mxh = fst[lvl][i].second;
    }
  for (; j >= 0; --j)
    if (snd[lvl][j].second > mxh) {
      mrg[lvl].push_back(snd[lvl][j]);
      mxh = snd[lvl][j].second;
    }
  reverse(begin(mrg[lvl]), end(mrg[lvl]));
  fst[lvl] = mrg[lvl];
  snd[lvl].clear();
  mrg[lvl].clear();
}
void apply(int a, int b) {
  for (int lvl = 0; lvl < k; ++lvl)
    for (auto i : fst[lvl])
      snd[lvl + 1].emplace_back(i.first + a, i.second + b);
  for (int lvl = 1; lvl <= k; ++lvl) merj(lvl);
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0), cout.tie(0);
  i64 t;
  int a, b;
  fst[0].emplace_back(0, 0);
  cin >> n >> k;
  for (int i = 0; i < n; ++i) {
    cin >> t;
    a = b = 0;
    while (t % 2 == 0) {
      ++a;
      t /= 2;
    }
    while (t % 5 == 0) {
      ++b;
      t /= 5;
    }
    apply(a, b);
  }
  for (auto i : fst[k]) ant = max(ant, min(i.first, i.second));
  cout << ant << endl;
  return 0;
}
