#include <bits/stdc++.h>
using namespace std;
template <class T>
inline T re() {
  T N = 0;
  char c = getchar();
  bool neg = 0;
  for (; c < '0' || c > '9'; c = getchar()) neg |= c == '-';
  for (; c >= '0' && c <= '9'; c = getchar()) N = (N << 3) + (N << 1) + c - '0';
  return neg ? -N : N;
}
const int MX = 200;
const int MXPOW5 = 8000;
int n, k;
long long a[MX + 5];
int two[MX + 5], five[MX + 5];
int dp[2][MX + 5][MXPOW5 + 5];
int main() {
  n = re<int>();
  k = re<int>();
  for (int i = 1; i <= n; i++) a[i] = re<long long>();
  for (int i = 1; i <= n; i++) {
    for (long long t = a[i]; t % 2 == 0; t /= 2) two[i]++;
    for (long long t = a[i]; t % 5 == 0; t /= 5) five[i]++;
  }
  int prv = 0, now = 1;
  for (int i = 0; i <= k; i++)
    for (int j = 0; j <= MXPOW5; j++) dp[prv][i][j] = -0x3f3f3f3f;
  dp[prv][0][0] = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j <= k; j++)
      for (int l = 0; l <= MXPOW5; l++) dp[now][j][l] = dp[prv][j][l];
    for (int j = 0; j < k; j++)
      for (int l = 0; l + five[i] <= MXPOW5; l++)
        dp[now][j + 1][l + five[i]] =
            max(dp[now][j + 1][l + five[i]], dp[prv][j][l] + two[i]);
    swap(now, prv);
  }
  int ans = 0;
  for (int i = 0; i <= MXPOW5; i++) ans = max(ans, min(i, dp[prv][k][i]));
  printf("%d\n", ans);
  return 0;
}
