#include <bits/stdc++.h>
using namespace std;
template <typename T1, typename T2>
ostream &operator<<(ostream &os, pair<T1, T2> p) {
  os << p.first << " " << p.second;
  return os;
}
template <typename T>
ostream &operator<<(ostream &os, vector<T> &v) {
  for (T i : v) os << i << ", ";
  return os;
}
template <typename T>
ostream &operator<<(ostream &os, set<T> second) {
  for (T i : second) os << i << ", ";
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, map<T1, T2> m) {
  for (pair<T1, T2> i : m) os << i << "\n";
  return os;
}
long long N, K;
long long a[200];
long long dp[2][5200][200];
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> N >> K;
  fill(dp[0][0], dp[1][5199] + 200, -1e9);
  long long mxidx = 0;
  long long ans = 0;
  for (long long i = 0; i < N; i++) {
    cin >> a[i];
    long long two = 0;
    while (a[i] % 2 == 0) {
      two++;
      a[i] /= 2;
    }
    long long five = 0;
    while (a[i] % 5 == 0) {
      five++;
      a[i] /= 5;
    }
    long long m1 = i % 2;
    long long m2 = !m1;
    mxidx += five;
    for (long long j = 0; j <= mxidx; j++) {
      for (long long k = 0; k <= min(K - 1, i); k++) {
        dp[m1][j][k] = dp[m2][j][k];
      }
    }
    dp[m1][five][0] = max(dp[m2][five][0], two);
    for (long long j = five; j <= mxidx; j++) {
      for (long long k = 1; k <= min(K - 1, i); k++) {
        dp[m1][j][k] = max(dp[m2][j][k], dp[m2][j - five][k - 1] + two);
      }
      for (long long k = 0; k <= min(K - 1, i); k++) {
        ans = max(ans, min(dp[m1][j][k], j));
      }
    }
  }
  cout << ans << "\n";
  return 0;
}
