#include <bits/stdc++.h>
using namespace std;
const double EPS = 1e-8;
const double PI = 2 * acos(0.0);
inline int cmp(double x, double y = 0, double tol = EPS) {
  return (x <= y + tol) ? (x + tol < y) ? -1 : 0 : 1;
}
bool debug = false;
int pd[2][212][26 * 212];
int main(void) {
  int n, m;
  cin >> n >> m;
  vector<pair<int, int> > vet(n);
  for (int i = 0; i < n; ++i) {
    long long v;
    cin >> v;
    while (v % 2 == 0) {
      v /= 2;
      ++vet[i].first;
    }
    while (v % 5 == 0) {
      v /= 5;
      ++vet[i].second;
    }
  }
  for (int j = 0; j <= m; ++j) {
    for (int k = 0; k < 26 * 212; ++k) {
      pd[0][j][k] = -0x3f3f3f3f;
      pd[1][j][k] = -0x3f3f3f3f;
    }
  }
  pd[0][0][0] = 0;
  pd[1][0][0] = 0;
  for (int i = 0; i < n; ++i) {
    for (int j = 1; j <= m; ++j) {
      for (int k = 0; k < vet[i].second; ++k) {
        pd[i & 1][j][k] = pd[!(i & 1)][j][k];
      }
      for (int k = vet[i].second; k < 26 * 212; ++k) {
        pd[i & 1][j][k] =
            max(pd[!(i & 1)][j][k],
                pd[!(i & 1)][j - 1][k - vet[i].second] + vet[i].first);
      }
    }
  }
  int out = 0;
  for (int k = 0; k < 26 * 212; ++k) {
    out = max(out, min(k, pd[!(n & 1)][m][k]));
  }
  cout << out << endl;
  return 0;
}
