#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
#include<vector>
#include<utility>
#include<set>
#include<queue>
#include<cmath>

using namespace std;

int n,k;
int fiv[206],two[206];

int dp[202][202][1625];

int dfs(int num,int tot,int five,int twoo)//��ǰ���� ѡ������ 5�ĸ���
{
	if(num==n+1||tot==k)
	{

		return min(five,twoo);
	}
	else
	{
		return max(dfs(num+1,tot+1,five+fiv[num],twoo+two[num]),dfs(num+1,tot,five,twoo));
	}
}
int main()
{
	scanf("%d%d",&n,&k);
	int nfiv=0,ntwo=0;long long x;
	for(int i=1;i<=n;i++)
	{
		scanf("%I64d",&x);
		while(!(x%5)){fiv[i]++;x/=5;nfiv++;}
		while(!(x%2)){two[i]++;x/=2;ntwo++;}
	}

	int ans=dfs(1,0,0,0);

	printf("%d\n",ans);

	return 0;
}

//max_int 67108864


#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
#include<vector>
#include<utility>
#include<set>
#include<queue>
#include<cmath>

using namespace std;

int n,k;
int fiv[206],two[206];

int dp[202][206][6*202];

int main()
{
	scanf("%d%d",&n,&k);
	int nfiv=0,ntwo=0;
	unsigned long long x;
	for(int i=1; i<=n; i++)
	{
		scanf("%I64d",&x);
		while(!(x%5))
		{
			fiv[i]++;
			x/=5;
			nfiv++;
		}
		while(!(x%2))
		{
			two[i]++;
			x/=2;
			ntwo++;
		}
	}

	memset(dp,-1,sizeof(dp));
	for(int i=0;i<=n;i++)for(int j=0;j<=n;j++)dp[i][j][0]=0;

	for(int i=1; i<=n; i++)
	{
		for(int j=1; j<=min(k,i); j++)
		{
			for(int w=nfiv; w>=fiv[i];w--)
			{
				dp[i][j][w]=max(dp[i-1][j][w],dp[i-1][j-1][w-fiv[i]]+two[i]);//前i个选j个有 k个5 dp=2的个数
			}
		}
	}

	int ans=0;

	for(int i=0;i<=nfiv;i++)ans=max(ans,min(dp[n][k][i],i));//5多了2不一定够

	printf("%d\n",ans);

	return 0;
}


#include <iostream>
#include <cstring>
#include <cctype>
#define maxn 205
using namespace std;
typedef long long llint;
template <class T>
void scan(T &x)
{
	char c;
	while (!isdigit(c = getchar()))
		;
	x = 0;
	do
		x = x * 10 + c - '0';
	while (isdigit(c = getchar()));
}
int n, v, c2[maxn], c5[maxn], cnt5 = 0;
int dp[maxn][30 * maxn]; // log_5(10^18)=25.75
bool avai[maxn][30 * maxn];
int main()
{
	ios::sync_with_stdio(false);
	llint a;
	scan(n);
	scan(v);
	for (int i = 1; i <= n; i++)
	{
		scan(a);
		while (a % 2 == 0)
		{
			c2[i]++;
			a /= 2;
		}
		while (a % 5 == 0)
		{
			c5[i]++;
			cnt5++;
			a /= 5;
		}
	}

	avai[0][0] = true;
	//f(i,j,k)=max{f(i-1,j,k),f(i-1,j-1,k-c5[i])+c2[i]}
	for (int i = 1; i <= n; i++)
	{
		for (int j = min(v, i); j >= 1; j--)
		{
			for (int k = cnt5; k >= c5[i]; k--)
			{
				int x = k - c5[i];
				int v1 = avai[j - 1][x] ? dp[j - 1][x] + c2[i] : 0, v2 = avai[j][k] ? dp[j][k] : 0;
				if (avai[j][k] = avai[j - 1][x] || avai[j][k])
					dp[j][k] = max(v1, v2);
			}
		}
	}

	int ans = 0;
	for (int i = 0; i <= cnt5; i++)
		if (avai[v][i])
			ans = max(ans, min(i, dp[v][i]));
	cout << ans << endl;
	return 0;
}


#include <iostream>
#include <cstring>
#include <cctype>
#define maxn 205
using namespace std;
typedef long long llint;
int n, v, c2[maxn], c5[maxn], cnt5 = 0;
int dp[maxn][30 * maxn]; // log_5(10^18)=25.75
bool avai[maxn][30 * maxn];
int main()
{
	ios::sync_with_stdio(false);
	llint a;
	cin>>n>>v;
	for (int i = 1; i <= n; i++)
	{
		cin>>a;
		while (a % 2 == 0)
		{
			c2[i]++;
			a /= 2;
		}
		while (a % 5 == 0)
		{
			c5[i]++;
			cnt5++;
			a /= 5;
		}
	}

	avai[0][0] = true;
	//f(i,j,k)=max{f(i-1,j,k),f(i-1,j-1,k-c5[i])+c2[i]}
	for (int i = 1; i <= n; i++)
	{
		for (int j = min(v, i); j >= 1; j--)
		{
			for (int k = cnt5; k >= c5[i]; k--)
			{
				int x = k - c5[i];
				int v1 = avai[j - 1][x] ? dp[j - 1][x] + c2[i] : 0, v2 = avai[j][k] ? dp[j][k] : 0;
				if (avai[j][k] = avai[j - 1][x] || avai[j][k])
					dp[j][k] = max(v1, v2);
			}
		}
	}

	int ans = 0;
	for (int i = 0; i <= cnt5; i++)
		if (avai[v][i])
			ans = max(ans, min(i, dp[v][i]));
	cout << ans << endl;
	return 0;
}


#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<functional>
#include<set>
#include<map>
#include<list>
#include<iomanip>
#include<cmath>
#include<queue>
#include<stack>
#include<complex>
#include<sstream>
#include<fstream>
#include<numeric>
#include<utility>
#include<stdio.h>
#include<assert.h>
#include<memory.h>
#include<bitset>
using namespace std;

#define Files

#define rdi(i)          scanf("%d", &i)
#define rdii(i, j)      scanf("%d%d", &i, &j)
#define rep(i, v)       for(int i=0;i<v.size();++i)
#define lp(i, n)        for(int i=0;i<(int)(n);++i)
#define lpi(i, j, n)    for(int i=(j);i<(int)(n);++i)
#define all(v)          ((v).begin()), ((v).end())
#define clr(v, d)       memset(v, d, sizeof(v))
#define lpd(i, j, n)    for(int i=(j);i>=(int)(n);--i)

typedef long long         ll;
typedef unsigned long long   ull;
const ll OO = 1e9;
const ll OOL = 1e17;
const ll MOD = 1e9 + 7;
const double EPS = 1e-9;

#define pb                  push_back
#define MP                  make_pair
typedef long double       ld;
typedef vector<int>       vi;
typedef vector<double>    vd;
typedef pair<int, int>    pii;
typedef pair<ll, ll>      pll;
typedef vector<pair<int, int> > vii;
typedef vector< vi >      vvi;
typedef vector< vd >      vvd;
typedef vector<string>    vs;
typedef vector<ll>        vl;
typedef vector<vector<ll> >     vvl;
typedef vector<pair<ll, ll> >   vll;

ull gcd(ull a, ull b) { return (b == 0 ? a : gcd(b, a % b)); }
ull lcm(ull a, ull b) { return (a * (b / gcd(a, b))); }
ll power(ll a, ll b){ if (b == 0) return 1; ll ans = power(a, b / 2); ans = ans * ans; if (b & 1) ans = ans * a; return ans; }

int DP[2][201][5350][2];
int two[201];
int five[201];

int main() {
#ifdef Filesx
	freopen("in.txt", "r", stdin);
	freopen("out.txt", "w", stdout);
#endif
	//ios::sync_with_stdio(0);

	int n, k; rdii(n, k);
	lp(i, n){
		ll x; scanf("%I64d", &x);
		while (x % 2 == 0) two[i]++, x /= 2;
		while (x % 5 == 0) five[i]++, x /= 5;
	}

	lpd(i, n - 1, 0){
		int now = i % 2;
		int nxt = (i + 1) % 2;
		lpd(has, k, 0){
			lp(more, 5300){
				lp(type, 2){
					// leave
					DP[now][has][more][type] = DP[nxt][has][more][type];

					// pick
					if (has + 1 <= k){
						int TWO = two[i] + more, FIVE = five[i];
						if (type == 1) TWO = two[i], FIVE = five[i] + more;
						int zeros = min(5350, abs(TWO - FIVE));
						if (TWO >= FIVE){
							DP[now][has][more][type] = max(DP[now][has][more][type], DP[nxt][has + 1][zeros][0] + FIVE);
						}
						if (FIVE >= TWO){
							DP[now][has][more][type] = max(DP[now][has][more][type], DP[nxt][has + 1][zeros][1] + TWO);
						}
					}
				}
			}
		}
	}

	printf("%d\n", DP[0][0][0][0]);

	return 0;
}


#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<functional>
#include<set>
#include<map>
#include<list>
#include<iomanip>
#include<cmath>
#include<queue>
#include<stack>
#include<complex>
#include<sstream>
#include<fstream>
#include<numeric>
#include<utility>
#include<stdio.h>
#include<assert.h>
#include<memory.h>
#include<bitset>
using namespace std;

#define Files

#define rdi(i)          scanf("%d", &i)
#define rdii(i, j)      scanf("%d%d", &i, &j)
#define rep(i, v)       for(int i=0;i<v.size();++i)
#define lp(i, n)        for(int i=0;i<(int)(n);++i)
#define lpi(i, j, n)    for(int i=(j);i<(int)(n);++i)
#define all(v)          ((v).begin()), ((v).end())
#define clr(v, d)       memset(v, d, sizeof(v))
#define lpd(i, j, n)    for(int i=(j);i>=(int)(n);--i)

typedef long long         ll;
typedef unsigned long long   ull;
const ll OO = 1e9;
const ll OOL = 1e17;
const ll MOD = 1e9 + 7;
const double EPS = 1e-9;

#define pb                  push_back
#define MP                  make_pair
typedef long double       ld;
typedef vector<int>       vi;
typedef vector<double>    vd;
typedef pair<int, int>    pii;
typedef pair<ll, ll>      pll;
typedef vector<pair<int, int> > vii;
typedef vector< vi >      vvi;
typedef vector< vd >      vvd;
typedef vector<string>    vs;
typedef vector<ll>        vl;
typedef vector<vector<ll> >     vvl;
typedef vector<pair<ll, ll> >   vll;

ull gcd(ull a, ull b) { return (b == 0 ? a : gcd(b, a % b)); }
ull lcm(ull a, ull b) { return (a * (b / gcd(a, b))); }
ll power(ll a, ll b){ if (b == 0) return 1; ll ans = power(a, b / 2); ans = ans * ans; if (b & 1) ans = ans * a; return ans; }

int DP[2][201][5060][2];
int two[201];
int five[201];

int main() {
#ifdef Filesx
	freopen("in.txt", "r", stdin);
	freopen("out.txt", "w", stdout);
#endif
	//ios::sync_with_stdio(0);

	int n, k; rdii(n, k);
	lp(i, n){
		ll x; scanf("%I64d", &x);
		while (x % 2 == 0) two[i]++, x /= 2;
		while (x % 5 == 0) five[i]++, x /= 5;
	}

	lpd(i, n - 1, 0){
		int now = i % 2;
		int nxt = (i + 1) % 2;
		lpd(has, k, 0){
			lp(more, 5030){
				lp(type, 2){
					// leave
					DP[now][has][more][type] = DP[nxt][has][more][type];

					// pick
					if (has + 1 <= k){
						int TWO = two[i] + more, FIVE = five[i];
						if (type == 1) TWO = two[i], FIVE = five[i] + more;
						int zeros = min(5060, abs(TWO - FIVE));
						if (TWO >= FIVE){
							DP[now][has][more][type] = max(DP[now][has][more][type], DP[nxt][has + 1][zeros][0] + FIVE);
						}
						if (FIVE >= TWO){
							DP[now][has][more][type] = max(DP[now][has][more][type], DP[nxt][has + 1][zeros][1] + TWO);
						}
					}
				}
			}
		}
	}

	printf("%d\n", DP[0][0][0][0]);

	return 0;
}


#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<functional>
#include<set>
#include<map>
#include<list>
#include<iomanip>
#include<cmath>
#include<queue>
#include<stack>
#include<complex>
#include<sstream>
#include<fstream>
#include<numeric>
#include<utility>
#include<stdio.h>
#include<assert.h>
#include<memory.h>
#include<bitset>
using namespace std;

#define Files

#define rdi(i)          scanf("%d", &i)
#define rdii(i, j)      scanf("%d%d", &i, &j)
#define rep(i, v)       for(int i=0;i<v.size();++i)
#define lp(i, n)        for(int i=0;i<(int)(n);++i)
#define lpi(i, j, n)    for(int i=(j);i<(int)(n);++i)
#define all(v)          ((v).begin()), ((v).end())
#define clr(v, d)       memset(v, d, sizeof(v))
#define lpd(i, j, n)    for(int i=(j);i>=(int)(n);--i)

typedef long long         ll;
typedef unsigned long long   ull;
const ll OO = 1e9;
const ll OOL = 1e17;
const ll MOD = 1e9 + 7;
const double EPS = 1e-9;

#define pb                  push_back
#define MP                  make_pair
typedef long double       ld;
typedef vector<int>       vi;
typedef vector<double>    vd;
typedef pair<int, int>    pii;
typedef pair<ll, ll>      pll;
typedef vector<pair<int, int> > vii;
typedef vector< vi >      vvi;
typedef vector< vd >      vvd;
typedef vector<string>    vs;
typedef vector<ll>        vl;
typedef vector<vector<ll> >     vvl;
typedef vector<pair<ll, ll> >   vll;

ull gcd(ull a, ull b) { return (b == 0 ? a : gcd(b, a % b)); }
ull lcm(ull a, ull b) { return (a * (b / gcd(a, b))); }
ll power(ll a, ll b){ if (b == 0) return 1; ll ans = power(a, b / 2); ans = ans * ans; if (b & 1) ans = ans * a; return ans; }

int DP[2][202][5600];
int two[201];
int five[201];

int main() {
#ifdef Filesx
	freopen("in.txt", "r", stdin);
	freopen("out.txt", "w", stdout);
#endif
	//ios::sync_with_stdio(0);

	int n, k; rdii(n, k);
	lp(i, n){
		ll x; scanf("%I64d", &x);
		while (x % 2 == 0) two[i]++, x /= 2;
		while (x % 5 == 0) five[i]++, x /= 5;
	}
	int ans = 0;
	lp(has, k + 2) lp(fives, 5600){
		DP[1][has][fives] = -OO;
	}
	DP[n % 2][k][0] = 0;
	lpd(i, n - 1, 0){
		int now = i % 2;
		int nxt = (i + 1) % 2;
		lpd(has, k, 0){
			lp(fives, 5500){
				DP[now][has][fives] = DP[nxt][has][fives];
				if (has + 1 <= k && fives >= five[i]){
					DP[now][has][fives] = max(DP[now][has][fives], DP[nxt][has + 1][fives - five[i]] + two[i]);
				}
			}
		}
	}
	lp(fives, 5600) ans = max(ans, min(fives, DP[0][0][fives]));

	printf("%d\n", ans);

	return 0;
}


#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<functional>
#include<set>
#include<map>
#include<list>
#include<iomanip>
#include<cmath>
#include<queue>
#include<stack>
#include<complex>
#include<sstream>
#include<fstream>
#include<numeric>
#include<utility>
#include<stdio.h>
#include<assert.h>
#include<memory.h>
#include<bitset>
using namespace std;

#define Files

#define rdi(i)          scanf("%d", &i)
#define rdii(i, j)      scanf("%d%d", &i, &j)
#define rep(i, v)       for(int i=0;i<v.size();++i)
#define lp(i, n)        for(int i=0;i<(int)(n);++i)
#define lpi(i, j, n)    for(int i=(j);i<(int)(n);++i)
#define all(v)          ((v).begin()), ((v).end())
#define clr(v, d)       memset(v, d, sizeof(v))
#define lpd(i, j, n)    for(int i=(j);i>=(int)(n);--i)

typedef long long         ll;
typedef unsigned long long   ull;
const ll OO = 1e9;
const ll OOL = 1e17;
const ll MOD = 1e9 + 7;
const double EPS = 1e-9;

#define pb                  push_back
#define MP                  make_pair
typedef long double       ld;
typedef vector<int>       vi;
typedef vector<double>    vd;
typedef pair<int, int>    pii;
typedef pair<ll, ll>      pll;
typedef vector<pair<int, int> > vii;
typedef vector< vi >      vvi;
typedef vector< vd >      vvd;
typedef vector<string>    vs;
typedef vector<ll>        vl;
typedef vector<vector<ll> >     vvl;
typedef vector<pair<ll, ll> >   vll;

ull gcd(ull a, ull b) { return (b == 0 ? a : gcd(b, a % b)); }
ull lcm(ull a, ull b) { return (a * (b / gcd(a, b))); }
ll power(ll a, ll b){ if (b == 0) return 1; ll ans = power(a, b / 2); ans = ans * ans; if (b & 1) ans = ans * a; return ans; }

int DP[2][201][6030][2];
int two[201];
int five[201];

int main() {
#ifdef Filesx
	freopen("in.txt", "r", stdin);
	freopen("out.txt", "w", stdout);
#endif
	//ios::sync_with_stdio(0);

	int n, k; rdii(n, k);
	lp(i, n){
		ll x; scanf("%I64d", &x);
		while (x % 2 == 0) two[i]++, x /= 2;
		while (x % 5 == 0) five[i]++, x /= 5;
	}

	lpd(i, n - 1, 0){
		int now = i % 2;
		int nxt = (i + 1) % 2;
		lpd(has, k, 0){
			lp(more, 6001){
				lp(type, 2){
					// leave
					DP[now][has][more][type] = DP[nxt][has][more][type];

					// pick
					if (has + 1 <= k){
						int TWO = two[i] + more, FIVE = five[i];
						if (type == 1) TWO = two[i], FIVE = five[i] + more;
						int zeros = min(6000, abs(TWO - FIVE));
						if (TWO >= FIVE){
							DP[now][has][more][type] = max(DP[now][has][more][type], DP[nxt][has + 1][zeros][0] + FIVE);
						}
						if (FIVE >= TWO){
							DP[now][has][more][type] = max(DP[now][has][more][type], DP[nxt][has + 1][zeros][1] + TWO);
						}
					}
				}
			}
		}
	}

	printf("%d\n", DP[0][0][0][0]);

	return 0;
}


#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<functional>
#include<set>
#include<map>
#include<list>
#include<iomanip>
#include<cmath>
#include<queue>
#include<stack>
#include<complex>
#include<sstream>
#include<fstream>
#include<numeric>
#include<utility>
#include<stdio.h>
#include<assert.h>
#include<memory.h>
#include<bitset>
using namespace std;

#define Files

#define rdi(i)          scanf("%d", &i)
#define rdii(i, j)      scanf("%d%d", &i, &j)
#define rep(i, v)       for(int i=0;i<v.size();++i)
#define lp(i, n)        for(int i=0;i<(int)(n);++i)
#define lpi(i, j, n)    for(int i=(j);i<(int)(n);++i)
#define all(v)          ((v).begin()), ((v).end())
#define clr(v, d)       memset(v, d, sizeof(v))
#define lpd(i, j, n)    for(int i=(j);i>=(int)(n);--i)

typedef long long         ll;
typedef unsigned long long   ull;
const ll OO = 1e9;
const ll OOL = 1e17;
const ll MOD = 1e9 + 7;
const double EPS = 1e-9;

#define pb                  push_back
#define MP                  make_pair
typedef long double       ld;
typedef vector<int>       vi;
typedef vector<double>    vd;
typedef pair<int, int>    pii;
typedef pair<ll, ll>      pll;
typedef vector<pair<int, int> > vii;
typedef vector< vi >      vvi;
typedef vector< vd >      vvd;
typedef vector<string>    vs;
typedef vector<ll>        vl;
typedef vector<vector<ll> >     vvl;
typedef vector<pair<ll, ll> >   vll;

ull gcd(ull a, ull b) { return (b == 0 ? a : gcd(b, a % b)); }
ull lcm(ull a, ull b) { return (a * (b / gcd(a, b))); }
ll power(ll a, ll b){ if (b == 0) return 1; ll ans = power(a, b / 2); ans = ans * ans; if (b & 1) ans = ans * a; return ans; }

int DP[2][201][3600][2];
int two[201];
int five[201];

int main() {
#ifdef Filesx
	freopen("in.txt", "r", stdin);
	freopen("out.txt", "w", stdout);
#endif
	//ios::sync_with_stdio(0);

	int n, k; rdii(n, k);
	lp(i, n){
		ll x; scanf("%I64d", &x);
		while (x % 2 == 0) two[i]++, x /= 2;
		while (x % 5 == 0) five[i]++, x /= 5;
	}

	lpd(i, n - 1, 0){
		int now = i % 2;
		int nxt = (i + 1) % 2;
		lpd(has, k, 0){
			lp(more, 3550){
				lp(type, 2){
					// leave
					DP[now][has][more][type] = DP[nxt][has][more][type];

					// pick
					if (has + 1 <= k){
						int TWO = two[i] + more, FIVE = five[i];
						if (type == 1) TWO = two[i], FIVE = five[i] + more;
						int zeros = min(3600, abs(TWO - FIVE));
						if (TWO >= FIVE){
							DP[now][has][more][type] = max(DP[now][has][more][type], DP[nxt][has + 1][zeros][0] + FIVE);
						}
						if (FIVE >= TWO){
							DP[now][has][more][type] = max(DP[now][has][more][type], DP[nxt][has + 1][zeros][1] + TWO);
						}
					}
				}
			}
		}
	}

	printf("%d\n", DP[0][0][0][0]);

	return 0;
}


#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<functional>
#include<set>
#include<map>
#include<list>
#include<iomanip>
#include<cmath>
#include<queue>
#include<stack>
#include<complex>
#include<sstream>
#include<fstream>
#include<numeric>
#include<utility>
#include<stdio.h>
#include<assert.h>
#include<memory.h>
#include<bitset>
using namespace std;

#define Files

#define rdi(i)          scanf("%d", &i)
#define rdii(i, j)      scanf("%d%d", &i, &j)
#define rep(i, v)       for(int i=0;i<v.size();++i)
#define lp(i, n)        for(int i=0;i<(int)(n);++i)
#define lpi(i, j, n)    for(int i=(j);i<(int)(n);++i)
#define all(v)          ((v).begin()), ((v).end())
#define clr(v, d)       memset(v, d, sizeof(v))
#define lpd(i, j, n)    for(int i=(j);i>=(int)(n);--i)

typedef long long         ll;
typedef unsigned long long   ull;
const ll OO = 1e9;
const ll OOL = 1e17;
const ll MOD = 1e9 + 7;
const double EPS = 1e-9;

#define pb                  push_back
#define MP                  make_pair
typedef long double       ld;
typedef vector<int>       vi;
typedef vector<double>    vd;
typedef pair<int, int>    pii;
typedef pair<ll, ll>      pll;
typedef vector<pair<int, int> > vii;
typedef vector< vi >      vvi;
typedef vector< vd >      vvd;
typedef vector<string>    vs;
typedef vector<ll>        vl;
typedef vector<vector<ll> >     vvl;
typedef vector<pair<ll, ll> >   vll;

ull gcd(ull a, ull b) { return (b == 0 ? a : gcd(b, a % b)); }
ull lcm(ull a, ull b) { return (a * (b / gcd(a, b))); }
ll power(ll a, ll b){ if (b == 0) return 1; ll ans = power(a, b / 2); ans = ans * ans; if (b & 1) ans = ans * a; return ans; }

int DP[2][202][5600];
int two[201];
int five[201];

int main() {
#ifdef Filesx
	freopen("in.txt", "r", stdin);
	freopen("out.txt", "w", stdout);
#endif
	//ios::sync_with_stdio(0);

	int n, k; rdii(n, k);
	lp(i, n){
		ll x; scanf("%I64d", &x);
		while (x % 2 == 0) two[i]++, x /= 2;
		while (x % 5 == 0) five[i]++, x /= 5;
	}
	int ans = 0;
	lp(has, k + 2) lp(fives, 5600){
		DP[n % 2][has][fives] = -OO;
	}
	DP[n % 2][k][0] = 0;
	lpd(i, n - 1, 0){
		int now = i % 2;
		int nxt = (i + 1) % 2;
		lpd(has, k, 0){
			lp(fives, 5500){
				DP[now][has][fives] = DP[nxt][has][fives];
				if (has + 1 <= k && fives >= five[i]){
					DP[now][has][fives] = max(DP[now][has][fives], DP[nxt][has + 1][fives - five[i]] + two[i]);
				}
			}
		}
	}
	lp(fives, 5600) ans = max(ans, min(fives, DP[0][0][fives]));

	printf("%d\n", ans);

	return 0;
}


#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<functional>
#include<set>
#include<map>
#include<list>
#include<iomanip>
#include<cmath>
#include<queue>
#include<stack>
#include<complex>
#include<sstream>
#include<fstream>
#include<numeric>
#include<utility>
#include<stdio.h>
#include<assert.h>
#include<memory.h>
#include<bitset>
using namespace std;

#define Files

#define rdi(i)          scanf("%d", &i)
#define rdii(i, j)      scanf("%d%d", &i, &j)
#define rep(i, v)       for(int i=0;i<v.size();++i)
#define lp(i, n)        for(int i=0;i<(int)(n);++i)
#define lpi(i, j, n)    for(int i=(j);i<(int)(n);++i)
#define all(v)          ((v).begin()), ((v).end())
#define clr(v, d)       memset(v, d, sizeof(v))
#define lpd(i, j, n)    for(int i=(j);i>=(int)(n);--i)

typedef long long         ll;
typedef unsigned long long   ull;
const ll OO = 1e9;
const ll OOL = 1e17;
const ll MOD = 1e9 + 7;
const double EPS = 1e-9;

#define pb                  push_back
#define MP                  make_pair
typedef long double       ld;
typedef vector<int>       vi;
typedef vector<double>    vd;
typedef pair<int, int>    pii;
typedef pair<ll, ll>      pll;
typedef vector<pair<int, int> > vii;
typedef vector< vi >      vvi;
typedef vector< vd >      vvd;
typedef vector<string>    vs;
typedef vector<ll>        vl;
typedef vector<vector<ll> >     vvl;
typedef vector<pair<ll, ll> >   vll;

ull gcd(ull a, ull b) { return (b == 0 ? a : gcd(b, a % b)); }
ull lcm(ull a, ull b) { return (a * (b / gcd(a, b))); }
ll power(ll a, ll b){ if (b == 0) return 1; ll ans = power(a, b / 2); ans = ans * ans; if (b & 1) ans = ans * a; return ans; }

int DP[2][201][13166][2];
int two[201];
int five[201];

int main() {
#ifdef Filesx
	freopen("in.txt", "r", stdin);
	freopen("out.txt", "w", stdout);
#endif
	ios::sync_with_stdio(0);

	int n, k; cin >> n >> k;
	lp(i, n){
		ll x; cin >> x;
		while (x % 2 == 0) two[i]++, x /= 2;
		while (x % 5 == 0) five[i]++, x /= 5;
	}

	lpd(i, n - 1, 0){
		int now = i % 2;
		int nxt = (i + 1) % 2;
		lpd(has, k, 0){
			lp(more, 13100){
				lp(type, 2){
					// leave
					DP[now][has][more][type] = DP[nxt][has][more][type];

					// pick
					if (has + 1 <= k){
						int TWO = two[i] + more, FIVE = five[i];
						if (type == 1) TWO = two[i], FIVE = five[i] + more;
						int zeros = abs(TWO - FIVE);
						if (TWO >= FIVE){
							DP[now][has][more][type] = max(DP[now][has][more][type], DP[nxt][has + 1][TWO - FIVE][0] + FIVE);
						}
						if (FIVE >= TWO){
							DP[now][has][more][type] = max(DP[now][has][more][type], DP[nxt][has + 1][FIVE - TWO][1] + TWO);
						}
					}
				}
			}
		}
	}

	cout << DP[0][0][0][0] << endl;

	return 0;
}


#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<functional>
#include<set>
#include<map>
#include<list>
#include<iomanip>
#include<cmath>
#include<queue>
#include<stack>
#include<complex>
#include<sstream>
#include<fstream>
#include<numeric>
#include<utility>
#include<stdio.h>
#include<assert.h>
#include<memory.h>
#include<bitset>
using namespace std;

#define Files

#define rdi(i)          scanf("%d", &i)
#define rdii(i, j)      scanf("%d%d", &i, &j)
#define rep(i, v)       for(int i=0;i<v.size();++i)
#define lp(i, n)        for(int i=0;i<(int)(n);++i)
#define lpi(i, j, n)    for(int i=(j);i<(int)(n);++i)
#define all(v)          ((v).begin()), ((v).end())
#define clr(v, d)       memset(v, d, sizeof(v))
#define lpd(i, j, n)    for(int i=(j);i>=(int)(n);--i)

typedef long long         ll;
typedef unsigned long long   ull;
const ll OO = 1e9;
const ll OOL = 1e17;
const ll MOD = 1e9 + 7;
const double EPS = 1e-9;

#define pb                  push_back
#define MP                  make_pair
typedef long double       ld;
typedef vector<int>       vi;
typedef vector<double>    vd;
typedef pair<int, int>    pii;
typedef pair<ll, ll>      pll;
typedef vector<pair<int, int> > vii;
typedef vector< vi >      vvi;
typedef vector< vd >      vvd;
typedef vector<string>    vs;
typedef vector<ll>        vl;
typedef vector<vector<ll> >     vvl;
typedef vector<pair<ll, ll> >   vll;

ull gcd(ull a, ull b) { return (b == 0 ? a : gcd(b, a % b)); }
ull lcm(ull a, ull b) { return (a * (b / gcd(a, b))); }
ll power(ll a, ll b){ if (b == 0) return 1; ll ans = power(a, b / 2); ans = ans * ans; if (b & 1) ans = ans * a; return ans; }

int DP[2][201][5500][2];
int two[201];
int five[201];

int main() {
#ifdef Filesx
	freopen("in.txt", "r", stdin);
	freopen("out.txt", "w", stdout);
#endif
	//ios::sync_with_stdio(0);

	int n, k; rdii(n, k);
	lp(i, n){
		ll x; scanf("%I64d", &x);
		while (x % 2 == 0) two[i]++, x /= 2;
		while (x % 5 == 0) five[i]++, x /= 5;
	}

	lpd(i, n - 1, 0){
		int now = i % 2;
		int nxt = (i + 1) % 2;
		lpd(has, k, 0){
			lp(more, 5450){
				lp(type, 2){
					// leave
					DP[now][has][more][type] = DP[nxt][has][more][type];

					// pick
					if (has + 1 <= k){
						int TWO = two[i] + more, FIVE = five[i];
						if (type == 1) TWO = two[i], FIVE = five[i] + more;
						int zeros = min(5500, abs(TWO - FIVE));
						if (TWO >= FIVE){
							DP[now][has][more][type] = max(DP[now][has][more][type], DP[nxt][has + 1][zeros][0] + FIVE);
						}
						if (FIVE >= TWO){
							DP[now][has][more][type] = max(DP[now][has][more][type], DP[nxt][has + 1][zeros][1] + TWO);
						}
					}
				}
			}
		}
	}

	printf("%d\n", DP[0][0][0][0]);

	return 0;
}


#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<functional>
#include<set>
#include<map>
#include<list>
#include<iomanip>
#include<cmath>
#include<queue>
#include<stack>
#include<complex>
#include<sstream>
#include<fstream>
#include<numeric>
#include<utility>
#include<stdio.h>
#include<assert.h>
#include<memory.h>
#include<bitset>
using namespace std;

#define Files

#define rdi(i)          scanf("%d", &i)
#define rdii(i, j)      scanf("%d%d", &i, &j)
#define rep(i, v)       for(int i=0;i<v.size();++i)
#define lp(i, n)        for(int i=0;i<(int)(n);++i)
#define lpi(i, j, n)    for(int i=(j);i<(int)(n);++i)
#define all(v)          ((v).begin()), ((v).end())
#define clr(v, d)       memset(v, d, sizeof(v))
#define lpd(i, j, n)    for(int i=(j);i>=(int)(n);--i)

typedef long long         ll;
typedef unsigned long long   ull;
const ll OO = 1e9;
const ll OOL = 1e17;
const ll MOD = 1e9 + 7;
const double EPS = 1e-9;

#define pb                  push_back
#define MP                  make_pair
typedef long double       ld;
typedef vector<int>       vi;
typedef vector<double>    vd;
typedef pair<int, int>    pii;
typedef pair<ll, ll>      pll;
typedef vector<pair<int, int> > vii;
typedef vector< vi >      vvi;
typedef vector< vd >      vvd;
typedef vector<string>    vs;
typedef vector<ll>        vl;
typedef vector<vector<ll> >     vvl;
typedef vector<pair<ll, ll> >   vll;

ull gcd(ull a, ull b) { return (b == 0 ? a : gcd(b, a % b)); }
ull lcm(ull a, ull b) { return (a * (b / gcd(a, b))); }
ll power(ll a, ll b){ if (b == 0) return 1; ll ans = power(a, b / 2); ans = ans * ans; if (b & 1) ans = ans * a; return ans; }

int DP[2][201][6030][2];
int two[201];
int five[201];

int main() {
#ifdef Filesx
	freopen("in.txt", "r", stdin);
	freopen("out.txt", "w", stdout);
#endif
	ios::sync_with_stdio(0);

	int n, k; cin >> n >> k;
	lp(i, n){
		ll x; cin >> x;
		while (x % 2 == 0) two[i]++, x /= 2;
		while (x % 5 == 0) five[i]++, x /= 5;
	}

	lpd(i, n - 1, 0){
		int now = i % 2;
		int nxt = (i + 1) % 2;
		lpd(has, k, 0){
			lp(more, 6001){
				lp(type, 2){
					// leave
					DP[now][has][more][type] = DP[nxt][has][more][type];

					// pick
					if (has + 1 <= k){
						int TWO = two[i] + more, FIVE = five[i];
						if (type == 1) TWO = two[i], FIVE = five[i] + more;
						int zeros = min(6000, abs(TWO - FIVE));
						if (TWO >= FIVE){
							DP[now][has][more][type] = max(DP[now][has][more][type], DP[nxt][has + 1][zeros][0] + FIVE);
						}
						if (FIVE >= TWO){
							DP[now][has][more][type] = max(DP[now][has][more][type], DP[nxt][has + 1][zeros][1] + TWO);
						}
					}
				}
			}
		}
	}

	cout << DP[0][0][0][0] << endl;

	return 0;
}


#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<functional>
#include<set>
#include<map>
#include<list>
#include<iomanip>
#include<cmath>
#include<queue>
#include<stack>
#include<complex>
#include<sstream>
#include<fstream>
#include<numeric>
#include<utility>
#include<stdio.h>
#include<assert.h>
#include<memory.h>
#include<bitset>
using namespace std;

#define Files

#define rdi(i)          scanf("%d", &i)
#define rdii(i, j)      scanf("%d%d", &i, &j)
#define rep(i, v)       for(int i=0;i<v.size();++i)
#define lp(i, n)        for(int i=0;i<(int)(n);++i)
#define lpi(i, j, n)    for(int i=(j);i<(int)(n);++i)
#define all(v)          ((v).begin()), ((v).end())
#define clr(v, d)       memset(v, d, sizeof(v))
#define lpd(i, j, n)    for(int i=(j);i>=(int)(n);--i)

typedef long long         ll;
typedef unsigned long long   ull;
const ll OO = 1e9;
const ll OOL = 1e17;
const ll MOD = 1e9 + 7;
const double EPS = 1e-9;

#define pb                  push_back
#define MP                  make_pair
typedef long double       ld;
typedef vector<int>       vi;
typedef vector<double>    vd;
typedef pair<int, int>    pii;
typedef pair<ll, ll>      pll;
typedef vector<pair<int, int> > vii;
typedef vector< vi >      vvi;
typedef vector< vd >      vvd;
typedef vector<string>    vs;
typedef vector<ll>        vl;
typedef vector<vector<ll> >     vvl;
typedef vector<pair<ll, ll> >   vll;

ull gcd(ull a, ull b) { return (b == 0 ? a : gcd(b, a % b)); }
ull lcm(ull a, ull b) { return (a * (b / gcd(a, b))); }
ll power(ll a, ll b){ if (b == 0) return 1; ll ans = power(a, b / 2); ans = ans * ans; if (b & 1) ans = ans * a; return ans; }

int DP[2][201][4260][2];
int two[201];
int five[201];

int main() {
#ifdef Filesx
	freopen("in.txt", "r", stdin);
	freopen("out.txt", "w", stdout);
#endif
	//ios::sync_with_stdio(0);

	int n, k; rdii(n, k);
	lp(i, n){
		ll x; scanf("%I64d", &x);
		while (x % 2 == 0) two[i]++, x /= 2;
		while (x % 5 == 0) five[i]++, x /= 5;
	}

	lpd(i, n - 1, 0){
		int now = i % 2;
		int nxt = (i + 1) % 2;
		lpd(has, k, 0){
			lp(more, 4230){
				lp(type, 2){
					// leave
					DP[now][has][more][type] = DP[nxt][has][more][type];

					// pick
					if (has + 1 <= k){
						int TWO = two[i] + more, FIVE = five[i];
						if (type == 1) TWO = two[i], FIVE = five[i] + more;
						int zeros = min(4260, abs(TWO - FIVE));
						if (TWO >= FIVE){
							DP[now][has][more][type] = max(DP[now][has][more][type], DP[nxt][has + 1][zeros][0] + FIVE);
						}
						if (FIVE >= TWO){
							DP[now][has][more][type] = max(DP[now][has][more][type], DP[nxt][has + 1][zeros][1] + TWO);
						}
					}
				}
			}
		}
	}

	printf("%d\n", DP[0][0][0][0]);

	return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)
#define repi(i,a,n) for(int i=a;i<n;i++)
#define mp make_pair
#define fastIO ios::sync_with_stdio(false)
#define read freopen("in.in","r",stdin)
#define write freopen("out.out","w",stdout)
#define scf(xx) scanf("%d",&xx)
#define scfl(xx) scanf("%I64d",&xx)
#define All(a) a.begin(), a.end()

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int, ll> ii;
typedef long double ld;

const int MAX = 3550;

int dp[2][201][MAX + 50][2];
int vis[201][MAX + 50][2];
int n;
int k;
int a[201];
int b[201];
int main()
{
	//fastIO;
	//read; write;
	scf(n);
	scf(k);
	rep(i, n){
		ll x;
		scfl(x);
		while (x % 2 == 0){
			x /= 2;
			a[i] ++;
		}
		while (x % 5 == 0){
			x /= 5;
			b[i] ++;
		}
	}
	vis[0][0][0] = 1;
	vis[0][0][1] = 1;
	//dp[0][0][0][0] = 1;
	int p = 1;
	int two, five;
	rep(N, n){
		memset(dp[p], 0, sizeof dp[p]);
		rep(K, k)rep(rest, MAX)rep(type, 2){
			if (!vis[K][rest][type])
				continue;
			if (type == 0){
				two = a[N] + rest;
				five = b[N];
			}
			else {
				two = a[N] ;
				five = b[N] + rest;
			}
			if (two >= five){
				int R = min(MAX - 1, two - five);
				dp[p][K + 1][R][0] = max(dp[p][K + 1][R][0], dp[!p][K][rest][type] + five);
				vis[K + 1][R][0] = 1;
			}
			if(two <= five) {
				int R = min(MAX - 1 , five - two);
				dp[p][K + 1][R][1] = max(dp[p][K + 1][R][1], dp[!p][K][rest][type] +  two);
				vis[K + 1][R][1] = 1;
			}
		}
		rep(K, k+1)rep(rest, MAX)rep(type, 2)dp[p][K][rest][type] = max(dp[p][K][rest][type], dp[!p][K][rest][type]);
		p = !p;
	}
	int res = 0;
	rep(rest, MAX)rep(type, 2)
		res = max(res, dp[!p][k][rest][type]);
	cout << res;
	return 0;
}


#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<functional>
#include<set>
#include<map>
#include<list>
#include<iomanip>
#include<cmath>
#include<queue>
#include<stack>
#include<complex>
#include<sstream>
#include<fstream>
#include<numeric>
#include<utility>
#include<stdio.h>
#include<assert.h>
#include<memory.h>
#include<bitset>
using namespace std;

#define Files

#define rdi(i)          scanf("%d", &i)
#define rdii(i, j)      scanf("%d%d", &i, &j)
#define rep(i, v)       for(int i=0;i<v.size();++i)
#define lp(i, n)        for(int i=0;i<(int)(n);++i)
#define lpi(i, j, n)    for(int i=(j);i<(int)(n);++i)
#define all(v)          ((v).begin()), ((v).end())
#define clr(v, d)       memset(v, d, sizeof(v))
#define lpd(i, j, n)    for(int i=(j);i>=(int)(n);--i)

typedef long long         ll;
typedef unsigned long long   ull;
const ll OO = 1e9;
const ll OOL = 1e17;
const ll MOD = 1e9 + 7;
const double EPS = 1e-9;

#define pb                  push_back
#define MP                  make_pair
typedef long double       ld;
typedef vector<int>       vi;
typedef vector<double>    vd;
typedef pair<int, int>    pii;
typedef pair<ll, ll>      pll;
typedef vector<pair<int, int> > vii;
typedef vector< vi >      vvi;
typedef vector< vd >      vvd;
typedef vector<string>    vs;
typedef vector<ll>        vl;
typedef vector<vector<ll> >     vvl;
typedef vector<pair<ll, ll> >   vll;

ull gcd(ull a, ull b) { return (b == 0 ? a : gcd(b, a % b)); }
ull lcm(ull a, ull b) { return (a * (b / gcd(a, b))); }
ll power(ll a, ll b){ if (b == 0) return 1; ll ans = power(a, b / 2); ans = ans * ans; if (b & 1) ans = ans * a; return ans; }

int DP[2][202][5600];
int two[201];
int five[201];

int main() {
#ifdef Filesx
	freopen("in.txt", "r", stdin);
	freopen("out.txt", "w", stdout);
#endif
	//ios::sync_with_stdio(0);

	int n, k; rdii(n, k);
	lp(i, n){
		ll x; scanf("%I64d", &x);
		while (x % 2 == 0) two[i]++, x /= 2;
		while (x % 5 == 0) five[i]++, x /= 5;
	}
	int ans = 0;
	lp(has, k + 2) lp(fives, 5600){
		DP[1][has][fives] = -OO;
	}
	DP[1][k][0] = 0;
	lpd(i, n - 1, 0){
		int now = i % 2;
		int nxt = (i + 1) % 2;
		lpd(has, k, 0){
			lp(fives, 5500){
				DP[now][has][fives] = DP[nxt][has][fives];
				if (has + 1 <= k && fives >= five[i]){
					DP[now][has][fives] = max(DP[now][has][fives], DP[nxt][has + 1][fives - five[i]] + two[i]);
				}
			}
		}
	}
	lp(fives, 5600) ans = max(ans, min(fives, DP[0][0][fives]));

	printf("%d\n", ans);

	return 0;
}


#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<functional>
#include<set>
#include<map>
#include<list>
#include<iomanip>
#include<cmath>
#include<queue>
#include<stack>
#include<complex>
#include<sstream>
#include<fstream>
#include<numeric>
#include<utility>
#include<stdio.h>
#include<assert.h>
#include<memory.h>
#include<bitset>
using namespace std;

#define Files

#define rdi(i)          scanf("%d", &i)
#define rdii(i, j)      scanf("%d%d", &i, &j)
#define rep(i, v)       for(int i=0;i<v.size();++i)
#define lp(i, n)        for(int i=0;i<(int)(n);++i)
#define lpi(i, j, n)    for(int i=(j);i<(int)(n);++i)
#define all(v)          ((v).begin()), ((v).end())
#define clr(v, d)       memset(v, d, sizeof(v))
#define lpd(i, j, n)    for(int i=(j);i>=(int)(n);--i)

typedef long long         ll;
typedef unsigned long long   ull;
const ll OO = 1e9;
const ll OOL = 1e17;
const ll MOD = 1e9 + 7;
const double EPS = 1e-9;

#define pb                  push_back
#define MP                  make_pair
typedef long double       ld;
typedef vector<int>       vi;
typedef vector<double>    vd;
typedef pair<int, int>    pii;
typedef pair<ll, ll>      pll;
typedef vector<pair<int, int> > vii;
typedef vector< vi >      vvi;
typedef vector< vd >      vvd;
typedef vector<string>    vs;
typedef vector<ll>        vl;
typedef vector<vector<ll> >     vvl;
typedef vector<pair<ll, ll> >   vll;

ull gcd(ull a, ull b) { return (b == 0 ? a : gcd(b, a % b)); }
ull lcm(ull a, ull b) { return (a * (b / gcd(a, b))); }
ll power(ll a, ll b){ if (b == 0) return 1; ll ans = power(a, b / 2); ans = ans * ans; if (b & 1) ans = ans * a; return ans; }

int DP[2][201][4560][2];
int two[201];
int five[201];

int main() {
#ifdef Filesx
	freopen("in.txt", "r", stdin);
	freopen("out.txt", "w", stdout);
#endif
	//ios::sync_with_stdio(0);

	int n, k; rdii(n, k);
	lp(i, n){
		ll x; scanf("%I64d", &x);
		while (x % 2 == 0) two[i]++, x /= 2;
		while (x % 5 == 0) five[i]++, x /= 5;
	}

	lpd(i, n - 1, 0){
		int now = i % 2;
		int nxt = (i + 1) % 2;
		lpd(has, k, 0){
			lp(more, 4530){
				lp(type, 2){
					// leave
					DP[now][has][more][type] = DP[nxt][has][more][type];

					// pick
					if (has + 1 <= k){
						int TWO = two[i] + more, FIVE = five[i];
						if (type == 1) TWO = two[i], FIVE = five[i] + more;
						int zeros = min(4560, abs(TWO - FIVE));
						if (TWO >= FIVE){
							DP[now][has][more][type] = max(DP[now][has][more][type], DP[nxt][has + 1][zeros][0] + FIVE);
						}
						if (FIVE >= TWO){
							DP[now][has][more][type] = max(DP[now][has][more][type], DP[nxt][has + 1][zeros][1] + TWO);
						}
					}
				}
			}
		}
	}

	printf("%d\n", DP[0][0][0][0]);

	return 0;
}


#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<functional>
#include<set>
#include<map>
#include<list>
#include<iomanip>
#include<cmath>
#include<queue>
#include<stack>
#include<complex>
#include<sstream>
#include<fstream>
#include<numeric>
#include<utility>
#include<stdio.h>
#include<assert.h>
#include<memory.h>
#include<bitset>
using namespace std;

#define Files

#define rdi(i)          scanf("%d", &i)
#define rdii(i, j)      scanf("%d%d", &i, &j)
#define rep(i, v)       for(int i=0;i<v.size();++i)
#define lp(i, n)        for(int i=0;i<(int)(n);++i)
#define lpi(i, j, n)    for(int i=(j);i<(int)(n);++i)
#define all(v)          ((v).begin()), ((v).end())
#define clr(v, d)       memset(v, d, sizeof(v))
#define lpd(i, j, n)    for(int i=(j);i>=(int)(n);--i)

typedef long long         ll;
typedef unsigned long long   ull;
const ll OO = 1e9;
const ll OOL = 1e17;
const ll MOD = 1e9 + 7;
const double EPS = 1e-9;

#define pb                  push_back
#define MP                  make_pair
typedef long double       ld;
typedef vector<int>       vi;
typedef vector<double>    vd;
typedef pair<int, int>    pii;
typedef pair<ll, ll>      pll;
typedef vector<pair<int, int> > vii;
typedef vector< vi >      vvi;
typedef vector< vd >      vvd;
typedef vector<string>    vs;
typedef vector<ll>        vl;
typedef vector<vector<ll> >     vvl;
typedef vector<pair<ll, ll> >   vll;

ull gcd(ull a, ull b) { return (b == 0 ? a : gcd(b, a % b)); }
ull lcm(ull a, ull b) { return (a * (b / gcd(a, b))); }
ll power(ll a, ll b){ if (b == 0) return 1; ll ans = power(a, b / 2); ans = ans * ans; if (b & 1) ans = ans * a; return ans; }

int DP[2][201][6050][2];
int two[201];
int five[201];

int main() {
#ifdef Filesx
	freopen("in.txt", "r", stdin);
	freopen("out.txt", "w", stdout);
#endif
	//ios::sync_with_stdio(0);

	int n, k; rdii(n, k);
	lp(i, n){
		ll x; scanf("%I64d", &x);
		while (x % 2 == 0) two[i]++, x /= 2;
		while (x % 5 == 0) five[i]++, x /= 5;
	}

	lpd(i, n - 1, 0){
		int now = i % 2;
		int nxt = (i + 1) % 2;
		lpd(has, k, 0){
			lp(more, 6000){
				lp(type, 2){
					// leave
					DP[now][has][more][type] = DP[nxt][has][more][type];

					// pick
					if (has + 1 <= k){
						int TWO = two[i] + more, FIVE = five[i];
						if (type == 1) TWO = two[i], FIVE = five[i] + more;
						int zeros = min(6050, abs(TWO - FIVE));
						if (TWO >= FIVE){
							DP[now][has][more][type] = max(DP[now][has][more][type], DP[nxt][has + 1][zeros][0] + FIVE);
						}
						if (FIVE >= TWO){
							DP[now][has][more][type] = max(DP[now][has][more][type], DP[nxt][has + 1][zeros][1] + TWO);
						}
					}
				}
			}
		}
	}

	printf("%d\n", DP[0][0][0][0]);

	return 0;
}


#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<functional>
#include<set>
#include<map>
#include<list>
#include<iomanip>
#include<cmath>
#include<queue>
#include<stack>
#include<complex>
#include<sstream>
#include<fstream>
#include<numeric>
#include<utility>
#include<stdio.h>
#include<assert.h>
#include<memory.h>
#include<bitset>
using namespace std;

#define Files

#define rdi(i)          scanf("%d", &i)
#define rdii(i, j)      scanf("%d%d", &i, &j)
#define rep(i, v)       for(int i=0;i<v.size();++i)
#define lp(i, n)        for(int i=0;i<(int)(n);++i)
#define lpi(i, j, n)    for(int i=(j);i<(int)(n);++i)
#define all(v)          ((v).begin()), ((v).end())
#define clr(v, d)       memset(v, d, sizeof(v))
#define lpd(i, j, n)    for(int i=(j);i>=(int)(n);--i)

typedef long long         ll;
typedef unsigned long long   ull;
const ll OO = 1e9;
const ll OOL = 1e17;
const ll MOD = 1e9 + 7;
const double EPS = 1e-9;

#define pb                  push_back
#define MP                  make_pair
typedef long double       ld;
typedef vector<int>       vi;
typedef vector<double>    vd;
typedef pair<int, int>    pii;
typedef pair<ll, ll>      pll;
typedef vector<pair<int, int> > vii;
typedef vector< vi >      vvi;
typedef vector< vd >      vvd;
typedef vector<string>    vs;
typedef vector<ll>        vl;
typedef vector<vector<ll> >     vvl;
typedef vector<pair<ll, ll> >   vll;

ull gcd(ull a, ull b) { return (b == 0 ? a : gcd(b, a % b)); }
ull lcm(ull a, ull b) { return (a * (b / gcd(a, b))); }
ll power(ll a, ll b){ if (b == 0) return 1; ll ans = power(a, b / 2); ans = ans * ans; if (b & 1) ans = ans * a; return ans; }

int DP[2][201][4060][2];
int two[201];
int five[201];

int main() {
#ifdef Filesx
	freopen("in.txt", "r", stdin);
	freopen("out.txt", "w", stdout);
#endif
	//ios::sync_with_stdio(0);

	int n, k; rdii(n, k);
	lp(i, n){
		ll x; scanf("%I64d", &x);
		while (x % 2 == 0) two[i]++, x /= 2;
		while (x % 5 == 0) five[i]++, x /= 5;
	}

	lpd(i, n - 1, 0){
		int now = i % 2;
		int nxt = (i + 1) % 2;
		lpd(has, k, 0){
			lp(more, 4030){
				lp(type, 2){
					// leave
					DP[now][has][more][type] = DP[nxt][has][more][type];

					// pick
					if (has + 1 <= k){
						int TWO = two[i] + more, FIVE = five[i];
						if (type == 1) TWO = two[i], FIVE = five[i] + more;
						int zeros = min(4060, abs(TWO - FIVE));
						if (TWO >= FIVE){
							DP[now][has][more][type] = max(DP[now][has][more][type], DP[nxt][has + 1][zeros][0] + FIVE);
						}
						if (FIVE >= TWO){
							DP[now][has][more][type] = max(DP[now][has][more][type], DP[nxt][has + 1][zeros][1] + TWO);
						}
					}
				}
			}
		}
	}

	printf("%d\n", DP[0][0][0][0]);

	return 0;
}


#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<functional>
#include<set>
#include<map>
#include<list>
#include<iomanip>
#include<cmath>
#include<queue>
#include<stack>
#include<complex>
#include<sstream>
#include<fstream>
#include<numeric>
#include<utility>
#include<stdio.h>
#include<assert.h>
#include<memory.h>
#include<bitset>
using namespace std;

#define Files

#define rdi(i)          scanf("%d", &i)
#define rdii(i, j)      scanf("%d%d", &i, &j)
#define rep(i, v)       for(int i=0;i<v.size();++i)
#define lp(i, n)        for(int i=0;i<(int)(n);++i)
#define lpi(i, j, n)    for(int i=(j);i<(int)(n);++i)
#define all(v)          ((v).begin()), ((v).end())
#define clr(v, d)       memset(v, d, sizeof(v))
#define lpd(i, j, n)    for(int i=(j);i>=(int)(n);--i)

typedef long long         ll;
typedef unsigned long long   ull;
const ll OO = 1e9;
const ll OOL = 1e17;
const ll MOD = 1e9 + 7;
const double EPS = 1e-9;

#define pb                  push_back
#define MP                  make_pair
typedef long double       ld;
typedef vector<int>       vi;
typedef vector<double>    vd;
typedef pair<int, int>    pii;
typedef pair<ll, ll>      pll;
typedef vector<pair<int, int> > vii;
typedef vector< vi >      vvi;
typedef vector< vd >      vvd;
typedef vector<string>    vs;
typedef vector<ll>        vl;
typedef vector<vector<ll> >     vvl;
typedef vector<pair<ll, ll> >   vll;

ull gcd(ull a, ull b) { return (b == 0 ? a : gcd(b, a % b)); }
ull lcm(ull a, ull b) { return (a * (b / gcd(a, b))); }
ll power(ll a, ll b){ if (b == 0) return 1; ll ans = power(a, b / 2); ans = ans * ans; if (b & 1) ans = ans * a; return ans; }

int DP[2][201][5050][2];
int two[201];
int five[201];

int main() {
#ifdef Filesx
	freopen("in.txt", "r", stdin);
	freopen("out.txt", "w", stdout);
#endif
	//ios::sync_with_stdio(0);

	int n, k; rdii(n, k);
	lp(i, n){
		ll x; scanf("%I64d", &x);
		while (x % 2 == 0) two[i]++, x /= 2;
		while (x % 5 == 0) five[i]++, x /= 5;
	}

	lpd(i, n - 1, 0){
		int now = i % 2;
		int nxt = (i + 1) % 2;
		lpd(has, k, 0){
			lp(more, 5000){
				lp(type, 2){
					// leave
					DP[now][has][more][type] = DP[nxt][has][more][type];

					// pick
					if (has + 1 <= k){
						int TWO = two[i] + more, FIVE = five[i];
						if (type == 1) TWO = two[i], FIVE = five[i] + more;
						int zeros = min(5050, abs(TWO - FIVE));
						if (TWO >= FIVE){
							DP[now][has][more][type] = max(DP[now][has][more][type], DP[nxt][has + 1][zeros][0] + FIVE);
						}
						if (FIVE >= TWO){
							DP[now][has][more][type] = max(DP[now][has][more][type], DP[nxt][has + 1][zeros][1] + TWO);
						}
					}
				}
			}
		}
	}

	printf("%d\n", DP[0][0][0][0]);

	return 0;
}


#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<functional>
#include<set>
#include<map>
#include<list>
#include<iomanip>
#include<cmath>
#include<queue>
#include<stack>
#include<complex>
#include<sstream>
#include<fstream>
#include<numeric>
#include<utility>
#include<stdio.h>
#include<assert.h>
#include<memory.h>
#include<bitset>
using namespace std;

#define Files

#define rdi(i)          scanf("%d", &i)
#define rdii(i, j)      scanf("%d%d", &i, &j)
#define rep(i, v)       for(int i=0;i<v.size();++i)
#define lp(i, n)        for(int i=0;i<(int)(n);++i)
#define lpi(i, j, n)    for(int i=(j);i<(int)(n);++i)
#define all(v)          ((v).begin()), ((v).end())
#define clr(v, d)       memset(v, d, sizeof(v))
#define lpd(i, j, n)    for(int i=(j);i>=(int)(n);--i)

typedef long long         ll;
typedef unsigned long long   ull;
const ll OO = 1e9;
const ll OOL = 1e17;
const ll MOD = 1e9 + 7;
const double EPS = 1e-9;

#define pb                  push_back
#define MP                  make_pair
typedef long double       ld;
typedef vector<int>       vi;
typedef vector<double>    vd;
typedef pair<int, int>    pii;
typedef pair<ll, ll>      pll;
typedef vector<pair<int, int> > vii;
typedef vector< vi >      vvi;
typedef vector< vd >      vvd;
typedef vector<string>    vs;
typedef vector<ll>        vl;
typedef vector<vector<ll> >     vvl;
typedef vector<pair<ll, ll> >   vll;

ull gcd(ull a, ull b) { return (b == 0 ? a : gcd(b, a % b)); }
ull lcm(ull a, ull b) { return (a * (b / gcd(a, b))); }
ll power(ll a, ll b){ if (b == 0) return 1; ll ans = power(a, b / 2); ans = ans * ans; if (b & 1) ans = ans * a; return ans; }

int DP[2][201][4360][2];
int two[201];
int five[201];

int main() {
#ifdef Filesx
	freopen("in.txt", "r", stdin);
	freopen("out.txt", "w", stdout);
#endif
	//ios::sync_with_stdio(0);

	int n, k; rdii(n, k);
	lp(i, n){
		ll x; scanf("%I64d", &x);
		while (x % 2 == 0) two[i]++, x /= 2;
		while (x % 5 == 0) five[i]++, x /= 5;
	}

	lpd(i, n - 1, 0){
		int now = i % 2;
		int nxt = (i + 1) % 2;
		lpd(has, k, 0){
			lp(more, 4330){
				lp(type, 2){
					// leave
					DP[now][has][more][type] = DP[nxt][has][more][type];

					// pick
					if (has + 1 <= k){
						int TWO = two[i] + more, FIVE = five[i];
						if (type == 1) TWO = two[i], FIVE = five[i] + more;
						int zeros = min(4360, abs(TWO - FIVE));
						if (TWO >= FIVE){
							DP[now][has][more][type] = max(DP[now][has][more][type], DP[nxt][has + 1][zeros][0] + FIVE);
						}
						if (FIVE >= TWO){
							DP[now][has][more][type] = max(DP[now][has][more][type], DP[nxt][has + 1][zeros][1] + TWO);
						}
					}
				}
			}
		}
	}

	printf("%d\n", DP[0][0][0][0]);

	return 0;
}


#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<functional>
#include<set>
#include<map>
#include<list>
#include<iomanip>
#include<cmath>
#include<queue>
#include<stack>
#include<complex>
#include<sstream>
#include<fstream>
#include<numeric>
#include<utility>
#include<stdio.h>
#include<assert.h>
#include<memory.h>
#include<bitset>
using namespace std;

#define Files

#define rdi(i)          scanf("%d", &i)
#define rdii(i, j)      scanf("%d%d", &i, &j)
#define rep(i, v)       for(int i=0;i<v.size();++i)
#define lp(i, n)        for(int i=0;i<(int)(n);++i)
#define lpi(i, j, n)    for(int i=(j);i<(int)(n);++i)
#define all(v)          ((v).begin()), ((v).end())
#define clr(v, d)       memset(v, d, sizeof(v))
#define lpd(i, j, n)    for(int i=(j);i>=(int)(n);--i)

typedef long long         ll;
typedef unsigned long long   ull;
const ll OO = 1e9;
const ll OOL = 1e17;
const ll MOD = 1e9 + 7;
const double EPS = 1e-9;

#define pb                  push_back
#define MP                  make_pair
typedef long double       ld;
typedef vector<int>       vi;
typedef vector<double>    vd;
typedef pair<int, int>    pii;
typedef pair<ll, ll>      pll;
typedef vector<pair<int, int> > vii;
typedef vector< vi >      vvi;
typedef vector< vd >      vvd;
typedef vector<string>    vs;
typedef vector<ll>        vl;
typedef vector<vector<ll> >     vvl;
typedef vector<pair<ll, ll> >   vll;

ull gcd(ull a, ull b) { return (b == 0 ? a : gcd(b, a % b)); }
ull lcm(ull a, ull b) { return (a * (b / gcd(a, b))); }
ll power(ll a, ll b){ if (b == 0) return 1; ll ans = power(a, b / 2); ans = ans * ans; if (b & 1) ans = ans * a; return ans; }

int DP[2][201][5450][2];
int two[201];
int five[201];

int main() {
#ifdef Filesx
	freopen("in.txt", "r", stdin);
	freopen("out.txt", "w", stdout);
#endif
	//ios::sync_with_stdio(0);

	int n, k; rdii(n, k);
	lp(i, n){
		ll x; scanf("%I64d", &x);
		while (x % 2 == 0) two[i]++, x /= 2;
		while (x % 5 == 0) five[i]++, x /= 5;
	}

	lpd(i, n - 1, 0){
		int now = i % 2;
		int nxt = (i + 1) % 2;
		lpd(has, k, 0){
			lp(more, 5400){
				lp(type, 2){
					// leave
					DP[now][has][more][type] = DP[nxt][has][more][type];

					// pick
					if (has + 1 <= k){
						int TWO = two[i] + more, FIVE = five[i];
						if (type == 1) TWO = two[i], FIVE = five[i] + more;
						int zeros = min(5450, abs(TWO - FIVE));
						if (TWO >= FIVE){
							DP[now][has][more][type] = max(DP[now][has][more][type], DP[nxt][has + 1][zeros][0] + FIVE);
						}
						if (FIVE >= TWO){
							DP[now][has][more][type] = max(DP[now][has][more][type], DP[nxt][has + 1][zeros][1] + TWO);
						}
					}
				}
			}
		}
	}

	printf("%d\n", DP[0][0][0][0]);

	return 0;
}


#include<iostream>
#include<algorithm>
#include<cstring>
#include<cmath>
#define ll long long

using namespace std;
const int maxn=205;
ll dp[maxn][60*maxn];
ll map[maxn],ans2;

ll judge(ll x)
{
    ll ans1=0;
    ll temp=x;
    ans2=0;
    while(temp)
    {
        if(x%2==0)
        {
            ans1++;
            x/=2;
        }
        else
        break;
    }
    while(temp)
    {
        if(x%5==0)
        {
            ans2++;
            x/=5;
        }
        else
        break;
    }

    return ans1;
}

int main()
{
    ll n,k,i,j,x,ans1,l;
    while(cin>>n>>k)
    {
        memset(dp,-0x3f3f3f3f,sizeof(dp));
        dp[0][0]=0;

        for(i=0;i<n;i++)
        {
            cin>>x;
            ans1=judge(x);
            for(j=k;j>=1;j--)
            {
                for(l=ans1;l<60*maxn;l++)
                {
                    dp[j][l]=max(dp[j][l],dp[j-1][l-ans1]+ans2);
                }
            }
        }
        ll ans=0;
        for(i=1;i<60*maxn;i++)
        {
            ans=max(ans,min(i,dp[k][i]));
        }
        cout<<ans<<endl;
    }
    return 0;
}


#include<iostream>
#include<vector>
#include<algorithm>
#include<stack>
#include<map>
#include<set>
#include<cstring>
#include<cstdio>
#include<queue>
#define N 205
using namespace std;
long long a[N];
int dp[N][65*N];
typedef struct node{
	int x;int y;
}node;
node b[N];
int fenjie(long long a,int b){
	int sum=0;
	while(a%b==0){
		sum++;
		a=a/b;
	}
	return sum;
}
int main(){
	int n,k;
	cin>>n>>k;
	for(int i=1;i<=n;i++)  cin>>a[i];
	for(int i=1;i<=n;i++){
		int t1=fenjie(a[i],2);
		int t2=fenjie(a[i],5);
		b[i].x=t1;b[i].y=t2;
	}
	memset(dp,-0x3f,sizeof(dp));
	dp[0][0]=0;
	for(int i=1;i<=n;i++){
	for(int j=k;j>=1;j--){
			for(int l=b[i].x;l<=65*N;l++){
				dp[j][l]=max(dp[j][l],dp[j-1][l-b[i].x]+b[i].y);
			}
	    }
	}
	int Max=0;
	for(int i=1;i<=N*64;i++){
		Max=max(Max,min(i,dp[k][i]));
	}
	cout<<Max<<endl;
}


#include<iostream>
#include<vector>
#include<algorithm>
#include<stack>
#include<map>
#include<set>
#include<cstring>
#include<cstdio>
#include<queue>
#define N 205
using namespace std;
long long a[N];
long long dp[N][60*N];
typedef struct node{
	long long x;long long y;
}node;
node b[N];
long long fenjie(long long a,int b){
	long long sum=0;
	while(a){
		if(a%b==0){
		sum++;
		a=a/b;}
		else{break;
		}
	}
	return sum;
}
int main(){
	long long n,k;
	while(cin>>n>>k){
	for(long long i=1;i<=n;i++)  cin>>a[i];
	for(long long i=1;i<=n;i++){
		long long t1=fenjie(a[i],2);
		long long t2=fenjie(a[i],5);
		b[i].x=t1;b[i].y=t2;
	}
	memset(dp,-0x3f3f3f3f,sizeof(dp));
	dp[0][0]=0;
	for(long long i=1;i<=n;i++){
	for(long long j=k;j>=1;j--){
			for(long long l=b[i].x;l<=65*N;l++){
				dp[j][l]=max(dp[j][l],dp[j-1][l-b[i].x]+b[i].y);}
	    }
	}
	long long Max=0;
	for(long long i=1;i<=N*64;i++){
		Max=max(Max,min(i, dp[k][i]));
	}
	cout<<Max<<endl;
}
	return 0;
}


#include<iostream>
#include<vector>
#include<algorithm>
#include<stack>
#include<map>
#include<set>
#include<cstring>
#include<cstdio>
#include<queue>
#define N 205
using namespace std;
long long a[N];
long long dp[N][65*N];
typedef struct node{
	long long x;long long y;
}node;
node b[N];
long long fenjie(long long a,int b){
	long long sum=0;
	while(a){
		if(a%b==0){
		sum++;
		a=a/b;}
		else{break;
		}
	}
	return sum;
}
int main(){
	long long n,k;
	while(cin>>n>>k){
//	cout<<fenjie(8,2)<<endl;
	for(long long i=1;i<=n;i++)  cin>>a[i];
	for(long long i=1;i<=n;i++){
		long long t1=fenjie(a[i],2);
		long long t2=fenjie(a[i],5);
		b[i].x=t1;b[i].y=t2;
	}
	memset(dp,-0x3f3f3f3f,sizeof(dp));
	dp[0][0]=0;
	for(long long i=1;i<=n;i++){
	for(long long j=k;j>=1;j--){
			for(long long l=b[i].x;l<=65*N;l++){
				dp[j][l]=max(dp[j][l],dp[j-1][l-b[i].x]+b[i].y);}
	    }
	}
	long long Max=0;
	for(long long i=1;i<=N*64;i++){
		Max=max(Max,min(i, dp[k][i]));
	}
	cout<<Max<<endl;
}
	return 0;
}


#include<iostream>
#include<vector>
#include<algorithm>
#include<stack>
#include<map>
#include<set>
#include<cstring>
#include<cstdio>
#include<queue>
#define N 205
using namespace std;
long long a[N];
long long dp[N][65*N];
typedef struct node{
	long long x;long long y;
}node;
node b[N];
long long fenjie(long long a,int b){
	int sum=0;
	while(a%b==0){
		sum++;
		a=a/b;
	}
	return sum;
}
int main(){
	long long n,k;
	cin>>n>>k;
	for(long long i=1;i<=n;i++)  cin>>a[i];
	for(long long i=1;i<=n;i++){
		long long t1=fenjie(a[i],2);
		long long t2=fenjie(a[i],5);
		b[i].x=t1;b[i].y=t2;
	}
	memset(dp,-0x3f,sizeof(dp));
	dp[0][0]=0;
	for(long long i=1;i<=n;i++){
	for(long long j=k;j>=1;j--){
			for(long long l=b[i].x;l<=65*N;l++){
				dp[j][l]=max(dp[j][l],dp[j-1][l-b[i].x]+b[i].y);
			}
	    }
	}
	long long Max=0;
	for(long long i=1;i<=N*64;i++){
		Max=max(Max,min(i,dp[k][i]));
	}
	cout<<Max<<endl;
	return 0;
}


#include<iostream>
#include<vector>
#include<algorithm>
#include<stack>
#include<map>
#include<set>
#include<cstring>
#include<cstdio>
#include<queue>
#define N 205
using namespace std;
long long a[N];
long long dp[N][65*N];
typedef struct node{
	long long x;long long y;
}node;
node b[N];
int fenjie(long long a,int b){
	int sum=0;
	while(a%b==0){
		sum++;
		a=a/b;
	}
	return sum;
}
int main(){
	long long n,k;
	cin>>n>>k;
	for(long long i=1;i<=n;i++)  cin>>a[i];
	for(long long i=1;i<=n;i++){
		long long t1=fenjie(a[i],2);
		long long t2=fenjie(a[i],5);
		b[i].x=t1;b[i].y=t2;
	}
	memset(dp,-0x3f,sizeof(dp));
	dp[0][0]=0;
	for(long long i=1;i<=n;i++){
	for(long long j=k;j>=1;j--){
			for(long long l=b[i].x;l<=65*N;l++){
				dp[j][l]=max(dp[j][l],dp[j-1][l-b[i].x]+b[i].y);
			}
	    }
	}
	long long Max=0;
	for(long long i=1;i<=N*64;i++){
		Max=max(Max,min(i,dp[k][i]));
	}
	cout<<Max<<endl;
	return 0;
}


#include<iostream>
#include<vector>
#include<algorithm>
#include<stack>
#include<map>
#include<set>
#include<cstring>
#include<cstdio>
#include<queue>
using namespace std;
long long a[205];
int dp[205][65];
typedef struct node{
	int x;int y;
}node;
node b[205];
int fenjie(long long a,int b){
	int sum=0;
	while(a%b==0){
		sum++;
		a=a/b;
	}
	return sum;
}
int main(){
	int n,k;
	cin>>n>>k;
	for(int i=1;i<=n;i++)  cin>>a[i];
	int sum=0;
	for(int i=1;i<=n;i++){
		int t1=fenjie(a[i],2);
		int t2=fenjie(a[i],5);
		b[i].x=t1;b[i].y=t2;
		sum+=b[i].x;
	}
	memset(dp,0,sizeof(dp));
	for(int i=1;i<=n;i++){
	for(int j=k;j>=1;j--){
			for(int l=b[i].x;l<=sum;l++){
				int t3;
				if(dp[j-1][l-b[i].x]+b[i].y>=l)  t3=l;
				else t3=dp[j-1][l-b[i].x]+b[i].y;
				dp[j][l]=max(dp[j][l],t3);
			}
	    }
	}
	int Max=0;
	for(int i=1;i<=sum;i++){
		Max=max(Max,dp[k][i]);
	}
	cout<<Max<<endl;
}


#include<iostream>
#include<vector>
#include<algorithm>
#include<stack>
#include<map>
#include<set>
#include<cstring>
#include<cstdio>
#include<queue>
#define N 205
using namespace std;
long long a[N];
long long dp[N][65*N];
typedef struct node{
	long long x;long long y;
}node;
node b[N];
long long fenjie(long long a,int b){
	long long sum=0;
	while(a%b==0){
		sum++;
		a=a/b;
	}
	return sum;
}
int main(){
	long long n,k;
	while(cin>>n>>k){
//	cout<<fenjie(8,2)<<endl;
	for(long long i=1;i<=n;i++)  cin>>a[i];
	for(long long i=1;i<=n;i++){
		long long t1=fenjie(a[i],2);
		long long t2=fenjie(a[i],5);
		b[i].x=t1;b[i].y=t2;
	}
	memset(dp,-0x3f3f3f3f,sizeof(dp));
	dp[0][0]=0;
	for(long long i=1;i<=n;i++){
	for(long long j=k;j>=1;j--){
			for(long long l=b[i].x;l<=65*N;l++){
				dp[j][l]=max(dp[j][l],dp[j-1][l-b[i].x]+b[i].y);}
	    }
	}
	long long Max=0;
	for(long long i=1;i<=N*64;i++){
		Max=max(Max,min(i, dp[k][i]));
	}
	cout<<Max<<endl;
}
	return 0;
}


#include<iostream>
#include<vector>
#include<algorithm>
#include<stack>
#include<map>
#include<set>
#include<cstring>
#include<cstdio>
#include<queue>
#define N 205
using namespace std;
long long a[N];
long long dp[N][65*N];
typedef struct node{
	long long x;long long y;
}node;
node b[N];
int fenjie(long long a,int b){
	int sum=0;
	while(a%b==0){
		sum++;
		a=a/b;
	}
	return sum;
}
int main(){
	long long n,k;
	cin>>n>>k;
	for(long long i=1;i<=n;i++)  cin>>a[i];
	for(long long i=1;i<=n;i++){
		long long t1=fenjie(a[i],2);
		long long t2=fenjie(a[i],5);
		b[i].x=t1;b[i].y=t2;
	}
	memset(dp,-0x3f,sizeof(dp));
	dp[0][0]=0;
	for(long long i=1;i<=n;i++){
	for(long long j=k;j>=1;j--){
			for(long long l=b[i].x;l<=65*N;l++){
				dp[j][l]=max(dp[j][l],dp[j-1][l-b[i].x]+b[i].y);
			}
	    }
	}
	long long Max=0;
	for(long long i=1;i<=N*64;i++){
		Max=max(Max,min(i,dp[k][i]));
	}
	cout<<Max<<endl;
}


#include<iostream>
#include<vector>
#include<algorithm>
#include<stack>
#include<map>
#include<set>
#include<cstring>
#include<cstdio>
#include<queue>
#define N 205
using namespace std;
long long a[N];
long long dp[N][13350];
typedef struct node{
	long long x;long long y;
}node;
node bb[N];
long long fenjie(long long a,int b){
	long long sum=0;
	while(a){
		if(a%b==0){
		sum++;
		a=a/b;}
		else{break;
		}
	}
	return sum;
}
int main(){
	long long n,k;
	while(cin>>n>>k){
	memset(a,0,sizeof(a));
	for(long long i=1;i<=n;i++)  cin>>a[i];
	for(int i=1;i<=205;i++){
		bb[i].x=0;bb[i].y=0;
	}
	for(long long i=1;i<=n;i++){
		long long t1=fenjie(a[i],2);
		long long t2=fenjie(a[i],5);
		bb[i].x=t1;bb[i].y=t2;
	}
	memset(dp,-0x3f,sizeof(dp));
	dp[0][0]=0;
	for(long long i=1;i<=n;i++){
	for(long long j=k;j>=1;j--){
			for(long long l=bb[i].x;l<13350;l++){
				dp[j][l]=max(dp[j][l],dp[j-1][l-bb[i].x]+bb[i].y);}
	    }
	}
	long long mmax=0;
	for(long long i=1;i<13350;i++){
		mmax=max(mmax,min(i,dp[k][i]));
	}
	cout<<mmax<<endl;
}
	return 0;
}


#include <cstdio>
#include <algorithm>
using namespace std;
#define mst(a,b) memset((a),(b),sizeof(a))
#define rush() int T;scanf("%d",&T);while(T--)

typedef long long ll;
const int maxn = 205;
const int maxm = 205*64;
const ll mod = 1e9+7;
const int INF = 0x3f3f3f;
const double eps = 1e-9;

int dp[maxn][maxm];
int n,k;
ll x;

int main()
{
    while(~scanf("%d%d",&n,&k))
    {
        for(int i=0;i<=k;i++)
        for(int j=0;j<maxm;j++)
        {
            dp[i][j]=-INF;
        }
        dp[0][0]=0;
        for(int i=0;i<n;i++)
        {
            int n2=0,n5=0;
            scanf("%I64d",&x);
            while(x%2==0) x/=2,n2++;
            while(x%5==0) x/=5,n5++;
            for(int j=k;j>=1;j--)
            for(int l=n2;l<maxm;l++)
            {
                dp[j][l]=max(dp[j][l],dp[j-1][l-n2]+n5);
            }
        }
        int ans=0;
        for(int i=1;i<maxm;i++)
        {
            ans=max(ans,min(i,dp[k][i]));
        }
        printf("%d\n",ans);
    }
    return 0;
}


#include<iostream>
using namespace std;
int max(int a,int b)
{
	return a>b?a:b;
}
int min(int a,int b)
{
	return a>b?b:a;
}
int main()
{
	int dp[3005][64]={0};
	int i,j,n,k,l,ans=0,y,m2,m5;
	long long x;
	cin>>n>>k;
	for(i=k;i>=0;i--)
	for(j=0;j<=64;j++) dp[i][j]=-1;
	dp[0][0]=0;
	while(n--)
	{
		cin>>x;
		m2=m5=0;
		while(x%2==0) x/=2,m2++;
		while(x%5==0) x/=5,m5++;
		for(i=k;i>=1;i--)
		for(j=m2;j<64;j++)
		{
			dp[i][j]=max(dp[i][j],dp[i-1][j-m2]+m5);
		}
	}
	for(i=1;i<64;i++) ans=max(ans,min(i,dp[k][i]));
	//for(i=1;i<=64;i++) cout<<dp[k][i]<<" ";
	cout<<ans<<endl;
}


//Written by Zhu Zeqi
//Come on,baby
//Hack,please
#include<cmath>
#include<math.h>
#include<ctype.h>
#include<algorithm>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cerrno>
#include<cfloat>
#include<ciso646>
#include<climits>
#include<clocale>
#include<complex>
#include<csetjmp>
#include<csignal>
#include<cstdarg>
#include<cstddef>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<ctime>
#include<cwchar>
#include<cwctype>
#include<deque>
#include<exception>
#include<fstream>
#include<functional>
#include<iomanip>
#include<ios>
#include<iosfwd>
#include<iostream>
#include<istream>
#include<iterator>
#include<limits>
#include<list>
#include<locale>
#include<map>
#include<memory>
#include<new>
#include<numeric>
#include<ostream>
#include<queue>
#include<set>
#include<sstream>
#include<stack>
#include<stdexcept>
#include<streambuf>
#include<string>
#include<typeinfo>
#include<utility>
#include<valarray>
#include<vector>
#include<string.h>
#include<stdlib.h>
#include<stdio.h>
#define CLR(x) memset(x,0,sizeof x)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define pii pair<int,int>
#define vi vector<int>
#define MAX 1000000000000000000
#define MOD 1000000007
#define PI 3.141592653589793238462
#define INF 0x3f3f3f3f
typedef long long ll;
//orz yht
using namespace std;
string i_s(int x){
	if(x==0)
	return "0";
	string ret="";
	while(x){
		ret=ret+(char)(x%10+'0');
		x/=10;
	}
	reverse(ret.begin(),ret.end());
	return ret;
}
string add(string a,string b){
	if(a=="")
	a="0";
	if(b=="")
	b="0";
	if(a.length()<b.length())
	swap(a,b);
	while(b.length()<a.length()){
		b='0'+b;
	}
	for(int i=0;i<a.length();i++){
		a[i]=a[i]+(b[i]-'0');
	}
	bool big=false;
	for(int i=a.length()-1;i>=0;i--){
		if(big){
			a[i]++;
		}
		big=false;
		if(a[i]>'9'){
			a[i]=a[i]-10;
			big=true;
		}
	}
	if(big)
	a='1'+a;
	return a;
}
string mul(string a,string b){
	vector<int> va,vb;
	if(a=="0" || b=="0")
	return "0";
	string ans;
	for(int i=0;i<a.length();i++){
		va.push_back(a[i]-'0');
	}
	for(int i=0;i<b.length();i++){
		vb.push_back(b[i]-'0');
	}
	reverse(va.begin(),va.end());
	reverse(vb.begin(),vb.end());
	vector<int> res;
	res.clear();
	res.resize(1005);
	for(int i=0;i<a.length();i++){
		for(int j=0;j<b.length();j++){
			res[i+j]+=(va[i]*vb[j]);
		}
	}
	for(int i=0;i<1005;i++){
		if(res[i]>9){
			res[i+1]+=(res[i]/10);
			res[i]%=10;
		}
	}
	for(int i=0;i<1005;i++){
		ans+=(res[i]+'0');
	}
	reverse(ans.begin(),ans.end());
	int k=0;
	while(ans[k]=='0'){
		k++;
	}
	ans=ans.substr(k);
	return ans;
}
bool is_prime(int n){
	if(n<2)
    return false;
    for(int i=2;i*i<=n;i++)
    if(n%i==0)
    return false;
    return true;
}
ll n,k,num2[205],num5[205],dp[2][205][10005],ans;
int main(){
	//freopen("input.in","r",stdin);
	//freopen("output.out","w",stdout);
	cin>>n>>k;
	for(ll i=1;i<=n;i++){
		ll x;
		cin>>x;
		while(x%2==0){
			x/=2;
			num2[i]++;
		}
		while(x%5==0){
			x/=5;
			num5[i]++;
		}
	}
	memset(dp,-127,sizeof(dp));
	dp[0][0][0]=0;
	for(ll i=1;i<=n;i++){
		memset(dp[i&1],-127,sizeof(dp[i&1]));
		for(ll j=0;j<=k;j++){
			for(ll z=0;z<=j*50;z++){
				if(z>=num5[i])
				dp[i&1][j][z]=max(dp[(i-1)&1][j][z],dp[(i-1)&1][j-1][z-num5[i]]+num2[i]);
				else
				dp[i&1][j][z]=dp[(i-1)&1][j][z];
			}
		}
	}
	for(ll i=0;i<=n*50;i++)
	ans=max(ans,min(i,dp[n&1][k][i]));
	cout<<ans;
	//system("pause");
	return 0;
}


//Written by Zhu Zeqi
//Come on,baby
//Hack,please
#include<cmath>
#include<math.h>
#include<ctype.h>
#include<algorithm>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cerrno>
#include<cfloat>
#include<ciso646>
#include<climits>
#include<clocale>
#include<complex>
#include<csetjmp>
#include<csignal>
#include<cstdarg>
#include<cstddef>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<ctime>
#include<cwchar>
#include<cwctype>
#include<deque>
#include<exception>
#include<fstream>
#include<functional>
#include<iomanip>
#include<ios>
#include<iosfwd>
#include<iostream>
#include<istream>
#include<iterator>
#include<limits>
#include<list>
#include<locale>
#include<map>
#include<memory>
#include<new>
#include<numeric>
#include<ostream>
#include<queue>
#include<set>
#include<sstream>
#include<stack>
#include<stdexcept>
#include<streambuf>
#include<string>
#include<typeinfo>
#include<utility>
#include<valarray>
#include<vector>
#include<string.h>
#include<stdlib.h>
#include<stdio.h>
#define CLR(x) memset(x,0,sizeof x)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define pii pair<int,int>
#define vi vector<int>
#define MAX 100000000000000000
#define MOD 1000000007
#define PI 3.141592653589793238462
#define INF 1000000000
typedef long long ll;
//orz yht
using namespace std;
string i_s(int x){
	if(x==0)
	return "0";
	string ret="";
	while(x){
		ret=ret+(char)(x%10+'0');
		x/=10;
	}
	reverse(ret.begin(),ret.end());
	return ret;
}
string add(string a,string b){
	if(a=="")
	a="0";
	if(b=="")
	b="0";
	if(a.length()<b.length())
	swap(a,b);
	while(b.length()<a.length()){
		b='0'+b;
	}
	for(int i=0;i<a.length();i++){
		a[i]=a[i]+(b[i]-'0');
	}
	bool big=false;
	for(int i=a.length()-1;i>=0;i--){
		if(big){
			a[i]++;
		}
		big=false;
		if(a[i]>'9'){
			a[i]=a[i]-10;
			big=true;
		}
	}
	if(big)
	a='1'+a;
	return a;
}
string mul(string a,string b){
	vector<int> va,vb;
	if(a=="0" || b=="0")
	return "0";
	string ans;
	for(int i=0;i<a.length();i++){
		va.push_back(a[i]-'0');
	}
	for(int i=0;i<b.length();i++){
		vb.push_back(b[i]-'0');
	}
	reverse(va.begin(),va.end());
	reverse(vb.begin(),vb.end());
	vector<int> res;
	res.clear();
	res.resize(1005);
	for(int i=0;i<a.length();i++){
		for(int j=0;j<b.length();j++){
			res[i+j]+=(va[i]*vb[j]);
		}
	}
	for(int i=0;i<1005;i++){
		if(res[i]>9){
			res[i+1]+=(res[i]/10);
			res[i]%=10;
		}
	}
	for(int i=0;i<1005;i++){
		ans+=(res[i]+'0');
	}
	reverse(ans.begin(),ans.end());
	int k=0;
	while(ans[k]=='0'){
		k++;
	}
	ans=ans.substr(k);
	return ans;
}
bool is_prime(int n){
	if(n<2)
    return false;
    for(int i=2;i*i<=n;i++)
    if(n%i==0)
    return false;
    return true;
}
int n,k,s;
int dp[10005][205];
int main(){
	//freopen("input.in","r",stdin);
	//freopen("output.out","w",stdout);
	cin>>n>>k;
	memset(dp,0x80,sizeof(dp));
	dp[0][0]=0;
	for(int z=1;z<=n;z++){
		ll a;
		cin>>a;
		int cnt1=0,cnt2=0;
		for(;!(a%5);a/=5)
		cnt1++;
		for(;!(a%2);a/=2)
		cnt2++;
		s+=cnt1;
		for(int i=k;i>=1;i--)
		for(int j=s;j>=cnt1;j--)
		dp[j][i]=max(dp[j][i],dp[j-cnt1][i-1]+cnt2);
	}
	int ans=0;
	for(int i=1;i<=s;i++)
	ans=max(ans,min(i,dp[i][k]));
	cout<<ans;
	//system("pause");
	return 0;
}


//Written by Zhu Zeqi
//Come on,baby
//Hack,please
#include<cmath>
#include<math.h>
#include<ctype.h>
#include<algorithm>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cerrno>
#include<cfloat>
#include<ciso646>
#include<climits>
#include<clocale>
#include<complex>
#include<csetjmp>
#include<csignal>
#include<cstdarg>
#include<cstddef>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<ctime>
#include<cwchar>
#include<cwctype>
#include<deque>
#include<exception>
#include<fstream>
#include<functional>
#include<iomanip>
#include<ios>
#include<iosfwd>
#include<iostream>
#include<istream>
#include<iterator>
#include<limits>
#include<list>
#include<locale>
#include<map>
#include<memory>
#include<new>
#include<numeric>
#include<ostream>
#include<queue>
#include<set>
#include<sstream>
#include<stack>
#include<stdexcept>
#include<streambuf>
#include<string>
#include<typeinfo>
#include<utility>
#include<valarray>
#include<vector>
#include<string.h>
#include<stdlib.h>
#include<stdio.h>
#define CLR(x) memset(x,0,sizeof x)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define pii pair<int,int>
#define vi vector<int>
#define MAX 100000000000000000
#define MOD 1000000007
#define PI 3.141592653589793238462
#define INF 1000000000
typedef long long ll;
//orz yht
using namespace std;
string i_s(int x){
	if(x==0)
	return "0";
	string ret="";
	while(x){
		ret=ret+(char)(x%10+'0');
		x/=10;
	}
	reverse(ret.begin(),ret.end());
	return ret;
}
string add(string a,string b){
	if(a=="")
	a="0";
	if(b=="")
	b="0";
	if(a.length()<b.length())
	swap(a,b);
	while(b.length()<a.length()){
		b='0'+b;
	}
	for(int i=0;i<a.length();i++){
		a[i]=a[i]+(b[i]-'0');
	}
	bool big=false;
	for(int i=a.length()-1;i>=0;i--){
		if(big){
			a[i]++;
		}
		big=false;
		if(a[i]>'9'){
			a[i]=a[i]-10;
			big=true;
		}
	}
	if(big)
	a='1'+a;
	return a;
}
string mul(string a,string b){
	vector<int> va,vb;
	if(a=="0" || b=="0")
	return "0";
	string ans;
	for(int i=0;i<a.length();i++){
		va.push_back(a[i]-'0');
	}
	for(int i=0;i<b.length();i++){
		vb.push_back(b[i]-'0');
	}
	reverse(va.begin(),va.end());
	reverse(vb.begin(),vb.end());
	vector<int> res;
	res.clear();
	res.resize(1005);
	for(int i=0;i<a.length();i++){
		for(int j=0;j<b.length();j++){
			res[i+j]+=(va[i]*vb[j]);
		}
	}
	for(int i=0;i<1005;i++){
		if(res[i]>9){
			res[i+1]+=(res[i]/10);
			res[i]%=10;
		}
	}
	for(int i=0;i<1005;i++){
		ans+=(res[i]+'0');
	}
	reverse(ans.begin(),ans.end());
	int k=0;
	while(ans[k]=='0'){
		k++;
	}
	ans=ans.substr(k);
	return ans;
}
bool is_prime(int n){
	if(n<2)
    return false;
    for(int i=2;i*i<=n;i++)
    if(n%i==0)
    return false;
    return true;
}
int n,k,s;
int dp[10005][205];
int main(){
	//freopen("input.in","r",stdin);
	//freopen("output.out","w",stdout);
	cin>>n>>k;
	for(int z=1;z<=n;z++){
		int a;
		cin>>a;
		int cnt1=0,cnt2=0;
		for(;!(a%5);a/=5)
		cnt1++;
		for(;!(a%2);a/=2)
		cnt2++;
		s+=cnt1;
		for(int i=k;i>=1;i--)
		for(int j=s;j>=cnt1;j--)
		dp[j][i]=max(dp[j][i],dp[j-cnt1][i-1]+cnt2);
	}
	int ans=0;
	for(int i=1;i<=s;i++)
	ans=max(ans,min(i,dp[i][k]));
	cout<<ans;
	//system("pause");
	return 0;
}


//Written by Zhu Zeqi
//Come on,baby
//Hack,please
#include<cmath>
#include<math.h>
#include<ctype.h>
#include<algorithm>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cerrno>
#include<cfloat>
#include<ciso646>
#include<climits>
#include<clocale>
#include<complex>
#include<csetjmp>
#include<csignal>
#include<cstdarg>
#include<cstddef>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<ctime>
#include<cwchar>
#include<cwctype>
#include<deque>
#include<exception>
#include<fstream>
#include<functional>
#include<iomanip>
#include<ios>
#include<iosfwd>
#include<iostream>
#include<istream>
#include<iterator>
#include<limits>
#include<list>
#include<locale>
#include<map>
#include<memory>
#include<new>
#include<numeric>
#include<ostream>
#include<queue>
#include<set>
#include<sstream>
#include<stack>
#include<stdexcept>
#include<streambuf>
#include<string>
#include<typeinfo>
#include<utility>
#include<valarray>
#include<vector>
#include<string.h>
#include<stdlib.h>
#include<stdio.h>
#define CLR(x) memset(x,0,sizeof x)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define pii pair<int,int>
#define vi vector<int>
#define MAX 100000000000000000
#define MOD 1000000007
#define PI 3.141592653589793238462
#define INF 1000000000
typedef long long ll;
//orz yht
using namespace std;
string i_s(int x){
	if(x==0)
	return "0";
	string ret="";
	while(x){
		ret=ret+(char)(x%10+'0');
		x/=10;
	}
	reverse(ret.begin(),ret.end());
	return ret;
}
string add(string a,string b){
	if(a=="")
	a="0";
	if(b=="")
	b="0";
	if(a.length()<b.length())
	swap(a,b);
	while(b.length()<a.length()){
		b='0'+b;
	}
	for(int i=0;i<a.length();i++){
		a[i]=a[i]+(b[i]-'0');
	}
	bool big=false;
	for(int i=a.length()-1;i>=0;i--){
		if(big){
			a[i]++;
		}
		big=false;
		if(a[i]>'9'){
			a[i]=a[i]-10;
			big=true;
		}
	}
	if(big)
	a='1'+a;
	return a;
}
string mul(string a,string b){
	vector<int> va,vb;
	if(a=="0" || b=="0")
	return "0";
	string ans;
	for(int i=0;i<a.length();i++){
		va.push_back(a[i]-'0');
	}
	for(int i=0;i<b.length();i++){
		vb.push_back(b[i]-'0');
	}
	reverse(va.begin(),va.end());
	reverse(vb.begin(),vb.end());
	vector<int> res;
	res.clear();
	res.resize(1005);
	for(int i=0;i<a.length();i++){
		for(int j=0;j<b.length();j++){
			res[i+j]+=(va[i]*vb[j]);
		}
	}
	for(int i=0;i<1005;i++){
		if(res[i]>9){
			res[i+1]+=(res[i]/10);
			res[i]%=10;
		}
	}
	for(int i=0;i<1005;i++){
		ans+=(res[i]+'0');
	}
	reverse(ans.begin(),ans.end());
	int k=0;
	while(ans[k]=='0'){
		k++;
	}
	ans=ans.substr(k);
	return ans;
}
bool is_prime(int n){
	if(n<2)
    return false;
    for(int i=2;i*i<=n;i++)
    if(n%i==0)
    return false;
    return true;
}
int n,k,s;
int dp[10005][205];
int main(){
	//freopen("input.in","r",stdin);
	//freopen("output.out","w",stdout);
	cin>>n>>k;
	memset(dp,INF,sizeof(dp));
	dp[0][0]=0;
	for(int z=1;z<=n;z++){
		ll a;
		cin>>a;
		int cnt1=0,cnt2=0;
		for(;!(a%5);a/=5)
		cnt1++;
		for(;!(a%2);a/=2)
		cnt2++;
		s+=cnt1;
		for(int i=k;i>=1;i--)
		for(int j=s;j>=cnt1;j--)
		dp[j][i]=max(dp[j][i],dp[j-cnt1][i-1]+cnt2);
	}
	int ans=0;
	for(int i=1;i<=s;i++)
	ans=max(ans,min(i,dp[i][k]));
	cout<<ans;
	//system("pause");
	return 0;
}


//Written by Zhu Zeqi
//Come on,baby
//Hack,please
#include<cmath>
#include<math.h>
#include<ctype.h>
#include<algorithm>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cerrno>
#include<cfloat>
#include<ciso646>
#include<climits>
#include<clocale>
#include<complex>
#include<csetjmp>
#include<csignal>
#include<cstdarg>
#include<cstddef>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<ctime>
#include<cwchar>
#include<cwctype>
#include<deque>
#include<exception>
#include<fstream>
#include<functional>
#include<iomanip>
#include<ios>
#include<iosfwd>
#include<iostream>
#include<istream>
#include<iterator>
#include<limits>
#include<list>
#include<locale>
#include<map>
#include<memory>
#include<new>
#include<numeric>
#include<ostream>
#include<queue>
#include<set>
#include<sstream>
#include<stack>
#include<stdexcept>
#include<streambuf>
#include<string>
#include<typeinfo>
#include<utility>
#include<valarray>
#include<vector>
#include<string.h>
#include<stdlib.h>
#include<stdio.h>
#define CLR(x) memset(x,0,sizeof x)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define pii pair<int,int>
#define vi vector<int>
#define MAX 1000000000000000000
#define MOD 1000000007
#define PI 3.141592653589793238462
#define INF 0x3f3f3f3f
typedef long long ll;
//orz yht
using namespace std;
string i_s(int x){
	if(x==0)
	return "0";
	string ret="";
	while(x){
		ret=ret+(char)(x%10+'0');
		x/=10;
	}
	reverse(ret.begin(),ret.end());
	return ret;
}
string add(string a,string b){
	if(a=="")
	a="0";
	if(b=="")
	b="0";
	if(a.length()<b.length())
	swap(a,b);
	while(b.length()<a.length()){
		b='0'+b;
	}
	for(int i=0;i<a.length();i++){
		a[i]=a[i]+(b[i]-'0');
	}
	bool big=false;
	for(int i=a.length()-1;i>=0;i--){
		if(big){
			a[i]++;
		}
		big=false;
		if(a[i]>'9'){
			a[i]=a[i]-10;
			big=true;
		}
	}
	if(big)
	a='1'+a;
	return a;
}
string mul(string a,string b){
	vector<int> va,vb;
	if(a=="0" || b=="0")
	return "0";
	string ans;
	for(int i=0;i<a.length();i++){
		va.push_back(a[i]-'0');
	}
	for(int i=0;i<b.length();i++){
		vb.push_back(b[i]-'0');
	}
	reverse(va.begin(),va.end());
	reverse(vb.begin(),vb.end());
	vector<int> res;
	res.clear();
	res.resize(1005);
	for(int i=0;i<a.length();i++){
		for(int j=0;j<b.length();j++){
			res[i+j]+=(va[i]*vb[j]);
		}
	}
	for(int i=0;i<1005;i++){
		if(res[i]>9){
			res[i+1]+=(res[i]/10);
			res[i]%=10;
		}
	}
	for(int i=0;i<1005;i++){
		ans+=(res[i]+'0');
	}
	reverse(ans.begin(),ans.end());
	int k=0;
	while(ans[k]=='0'){
		k++;
	}
	ans=ans.substr(k);
	return ans;
}
bool is_prime(int n){
	if(n<2)
    return false;
    for(int i=2;i*i<=n;i++)
    if(n%i==0)
    return false;
    return true;
}
int n,k,num2[205],num5[205],dp[2][205][10005],ans;
int main(){
	//freopen("input.in","r",stdin);
	//freopen("output.out","w",stdout);
	cin>>n>>k;
	for(int i=1;i<=n;i++){
		int x;
		cin>>x;
		while(x%2==0){
			x/=2;
			num2[i]++;
		}
		while(x%5==0){
			x/=5;
			num5[i]++;
		}
	}
	memset(dp,-127,sizeof(dp));
	dp[0][0][0]=0;
	for(int i=1;i<=n;i++){
		memset(dp[i&1],-127,sizeof(dp[i&1]));
		for(int j=0;j<=k;j++){
			for(int z=0;z<=j*50;z++){
				if(z>=num5[i])
				dp[i&1][j][z]=max(dp[(i-1)&1][j][z],dp[(i-1)&1][j-1][z-num5[i]]+num2[i]);
				else
				dp[i&1][j][z]=dp[(i-1)&1][j][z];
			}
		}
	}
	for(int i=0;i<=n*50;i++)
	ans=max(ans,min(i,dp[n&1][k][i]));
	cout<<ans;
	//system("pause");
	return 0;
}


//Written by Zhu Zeqi
//Come on,baby
//Hack,please
#include<cmath>
#include<math.h>
#include<ctype.h>
#include<algorithm>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cerrno>
#include<cfloat>
#include<ciso646>
#include<climits>
#include<clocale>
#include<complex>
#include<csetjmp>
#include<csignal>
#include<cstdarg>
#include<cstddef>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<ctime>
#include<cwchar>
#include<cwctype>
#include<deque>
#include<exception>
#include<fstream>
#include<functional>
#include<iomanip>
#include<ios>
#include<iosfwd>
#include<iostream>
#include<istream>
#include<iterator>
#include<limits>
#include<list>
#include<locale>
#include<map>
#include<memory>
#include<new>
#include<numeric>
#include<ostream>
#include<queue>
#include<set>
#include<sstream>
#include<stack>
#include<stdexcept>
#include<streambuf>
#include<string>
#include<typeinfo>
#include<utility>
#include<valarray>
#include<vector>
#include<string.h>
#include<stdlib.h>
#include<stdio.h>
#define CLR(x) memset(x,0,sizeof x)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define pii pair<int,int>
#define vi vector<int>
#define MAX 1000000000000000000
#define MOD 1000000007
#define PI 3.141592653589793238462
#define INF 0x3f3f3f3f
typedef long long ll;
//orz yht
using namespace std;
string i_s(int x){
	if(x==0)
	return "0";
	string ret="";
	while(x){
		ret=ret+(char)(x%10+'0');
		x/=10;
	}
	reverse(ret.begin(),ret.end());
	return ret;
}
string add(string a,string b){
	if(a=="")
	a="0";
	if(b=="")
	b="0";
	if(a.length()<b.length())
	swap(a,b);
	while(b.length()<a.length()){
		b='0'+b;
	}
	for(int i=0;i<a.length();i++){
		a[i]=a[i]+(b[i]-'0');
	}
	bool big=false;
	for(int i=a.length()-1;i>=0;i--){
		if(big){
			a[i]++;
		}
		big=false;
		if(a[i]>'9'){
			a[i]=a[i]-10;
			big=true;
		}
	}
	if(big)
	a='1'+a;
	return a;
}
string mul(string a,string b){
	vector<int> va,vb;
	if(a=="0" || b=="0")
	return "0";
	string ans;
	for(int i=0;i<a.length();i++){
		va.push_back(a[i]-'0');
	}
	for(int i=0;i<b.length();i++){
		vb.push_back(b[i]-'0');
	}
	reverse(va.begin(),va.end());
	reverse(vb.begin(),vb.end());
	vector<int> res;
	res.clear();
	res.resize(1005);
	for(int i=0;i<a.length();i++){
		for(int j=0;j<b.length();j++){
			res[i+j]+=(va[i]*vb[j]);
		}
	}
	for(int i=0;i<1005;i++){
		if(res[i]>9){
			res[i+1]+=(res[i]/10);
			res[i]%=10;
		}
	}
	for(int i=0;i<1005;i++){
		ans+=(res[i]+'0');
	}
	reverse(ans.begin(),ans.end());
	int k=0;
	while(ans[k]=='0'){
		k++;
	}
	ans=ans.substr(k);
	return ans;
}
bool is_prime(int n){
	if(n<2)
    return false;
    for(int i=2;i*i<=n;i++)
    if(n%i==0)
    return false;
    return true;
}
int n,k,dp[10005][205];
int main(){
	//freopen("input.in","r",stdin);
	//freopen("output.out","w",stdout);
	cin>>n>>k;
	int s;
	memset(dp,INF,sizeof(dp));
	dp[0][0]=0;
	for(int z=1;z<=n;z++){
		ll a;
		cin>>a;
		int cnt1=0,cnt2=0;
		for(;!(a%5);a/=5)
		cnt1++;
		for(;!(a%2);a/=2)
		cnt2++;
		s+=cnt1;
		for(int i=k;i>=1;i--)
		for(int j=s;j>=cnt1;j--)
		dp[j][i]=max(dp[j][i],dp[j-cnt1][i-1]+cnt2);
	}
	int ans=0;
	for(int i=1;i<=s;i++)
	ans=max(ans,min(i,dp[i][k]));
	cout<<ans;
	//system("pause");
	return 0;
}


//Written by Zhu Zeqi
//Come on,baby
//Hack,please
#include<cmath>
#include<math.h>
#include<ctype.h>
#include<algorithm>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cerrno>
#include<cfloat>
#include<ciso646>
#include<climits>
#include<clocale>
#include<complex>
#include<csetjmp>
#include<csignal>
#include<cstdarg>
#include<cstddef>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<ctime>
#include<cwchar>
#include<cwctype>
#include<deque>
#include<exception>
#include<fstream>
#include<functional>
#include<iomanip>
#include<ios>
#include<iosfwd>
#include<iostream>
#include<istream>
#include<iterator>
#include<limits>
#include<list>
#include<locale>
#include<map>
#include<memory>
#include<new>
#include<numeric>
#include<ostream>
#include<queue>
#include<set>
#include<sstream>
#include<stack>
#include<stdexcept>
#include<streambuf>
#include<string>
#include<typeinfo>
#include<utility>
#include<valarray>
#include<vector>
#include<string.h>
#include<stdlib.h>
#include<stdio.h>
#define CLR(x) memset(x,0,sizeof x)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define pii pair<int,int>
#define vi vector<int>
#define MAX 100000000000000000
#define MOD 1000000007
#define PI 3.141592653589793238462
#define INF 1000000000
typedef long long ll;
//orz yht
using namespace std;
string i_s(int x){
	if(x==0)
	return "0";
	string ret="";
	while(x){
		ret=ret+(char)(x%10+'0');
		x/=10;
	}
	reverse(ret.begin(),ret.end());
	return ret;
}
string add(string a,string b){
	if(a=="")
	a="0";
	if(b=="")
	b="0";
	if(a.length()<b.length())
	swap(a,b);
	while(b.length()<a.length()){
		b='0'+b;
	}
	for(int i=0;i<a.length();i++){
		a[i]=a[i]+(b[i]-'0');
	}
	bool big=false;
	for(int i=a.length()-1;i>=0;i--){
		if(big){
			a[i]++;
		}
		big=false;
		if(a[i]>'9'){
			a[i]=a[i]-10;
			big=true;
		}
	}
	if(big)
	a='1'+a;
	return a;
}
string mul(string a,string b){
	vector<int> va,vb;
	if(a=="0" || b=="0")
	return "0";
	string ans;
	for(int i=0;i<a.length();i++){
		va.push_back(a[i]-'0');
	}
	for(int i=0;i<b.length();i++){
		vb.push_back(b[i]-'0');
	}
	reverse(va.begin(),va.end());
	reverse(vb.begin(),vb.end());
	vector<int> res;
	res.clear();
	res.resize(1005);
	for(int i=0;i<a.length();i++){
		for(int j=0;j<b.length();j++){
			res[i+j]+=(va[i]*vb[j]);
		}
	}
	for(int i=0;i<1005;i++){
		if(res[i]>9){
			res[i+1]+=(res[i]/10);
			res[i]%=10;
		}
	}
	for(int i=0;i<1005;i++){
		ans+=(res[i]+'0');
	}
	reverse(ans.begin(),ans.end());
	int k=0;
	while(ans[k]=='0'){
		k++;
	}
	ans=ans.substr(k);
	return ans;
}
bool is_prime(int n){
	if(n<2)
    return false;
    for(int i=2;i*i<=n;i++)
    if(n%i==0)
    return false;
    return true;
}
int n,k,s;
int dp[10005][205];
int main(){
	//freopen("input.in","r",stdin);
	//freopen("output.out","w",stdout);
	cin>>n>>k;
	memset(dp,INF,sizeof(dp));
	dp[0][0]=0;
	for(int z=1;z<=n;z++){
		int a;
		cin>>a;
		int cnt1=0,cnt2=0;
		for(;!(a%5);a/=5)
		cnt1++;
		for(;!(a%2);a/=2)
		cnt2++;
		s+=cnt1;
		for(int i=k;i>=1;i--)
		for(int j=s;j>=cnt1;j--)
		dp[j][i]=max(dp[j][i],dp[j-cnt1][i-1]+cnt2);
	}
	int ans=0;
	for(int i=1;i<=s;i++)
	ans=max(ans,min(i,dp[i][k]));
	cout<<ans;
	//system("pause");
	return 0;
}


#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <cstring>

using namespace std;

typedef long long llint;

const int INF=0x3f3f3f3f;
const int N=205;

int n, k, zbr_petice=0;
int dvojke[N], petice[N];
int dp[2][N][200*30];

void load() {
    scanf("%d %d", &n, &k);
    for (int i=0; i<n; ++i) {
        llint y;
        cin >>y;
        llint x=y;
        while (x%2==0) {
            dvojke[i]++;
            x/=2;
        }
        while (x%5==0) {
            petice[i]++;
            zbr_petice++;
            x/=5;
        }
    }
    memset(dp, -1, sizeof dp);
}

void solve() {
    //cout <<rek(0, 0, 0)<<endl;
    dp[0][0][0]=0;
    dp[0][1][petice[0]]=dvojke[0];
    int sol=0;
    for (int i=0; i<n; ++i) {
        for (int j=0; j<=i; ++j) {
            if (i==0 && j==0) continue;
            for (int l=0; l<=zbr_petice; ++l) {
                if (i>0) dp[1][j][l]=max(dp[1][j][l], dp[0][j][l]);
                if (i>0 && j>0 && l>=petice[i]) dp[1][j][l]=max(dp[1][j][l], dp[0][j-1][l-petice[i]]+dvojke[i]);
                //cout <<i<<" "<<j<<" "<<l<<" -> "<<dp[i][j][l]<<endl;
                dp[0][j][l]=dp[1][j][l];
            }
        }
    }
    for (int i=1; i<=zbr_petice; ++i) sol=max(sol, min(i, dp[0][k][i]));
    printf("%d", sol);
}

int main() {
    load();
    solve();
}


#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <cstring>

using namespace std;

const int INF=0x3f3f3f3f;
const int N=205;

int n, k, zbr_petice=0;
int p[N], dvojke[N], petice[N];
int dp[N][N][N*30];

void load() {
    scanf("%d %d", &n, &k);
    for (int i=0; i<n; ++i) {
        scanf("%d", &p[i]);
        int x=p[i];
        while (x%2==0) {
            dvojke[i]++;
            x/=2;
        }
        x=p[i];
        while (x%5==0) {
            petice[i]++;
            zbr_petice++;
            x/=5;
        }
    }
    memset(dp, -1, sizeof dp);
}

void solve() {
    //cout <<rek(0, 0, 0)<<endl;
    dp[0][0][0]=0;
    dp[0][1][petice[0]]=dvojke[0];
    int sol=0;
    for (int i=0; i<n; ++i) {
        for (int j=0; j<=i; ++j) {
            if (i==0 && j==0) continue;
            for (int l=0; l<=zbr_petice; ++l) {
                if (i>0) dp[i][j][l]=max(dp[i][j][l], dp[i-1][j][l]);
                if (i>0 && j>0 && l>=petice[i]) dp[i][j][l]=max(dp[i][j][l], dp[i-1][j-1][l-petice[i]]+dvojke[i]);
                //cout <<i<<" "<<j<<" "<<l<<" -> "<<dp[i][j][l]<<endl;
            }
        }
    }
    for (int i=1; i<=zbr_petice; ++i) sol=max(sol, min(i, dp[n-1][k][i]));
    printf("%d", sol);
}

int main() {
    load();
    solve();
}


#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <cstring>

using namespace std;

typedef long long llint;

const int INF=0x3f3f3f3f;
const int N=205;

int n, k, zbr_petice=0;
int dvojke[N], petice[N];
int dp[2][N][200*30];

void load() {
    scanf("%d %d", &n, &k);
    for (int i=0; i<n; ++i) {
        llint y;
        scanf("%l64d", &y);
        llint x=y;
        while (x%2==0) {
            dvojke[i]++;
            x/=2;
        }
        while (x%5==0) {
            petice[i]++;
            zbr_petice++;
            x/=5;
        }
    }
    memset(dp, -1, sizeof dp);
}

void solve() {
    //cout <<rek(0, 0, 0)<<endl;
    dp[0][0][0]=0;
    dp[0][1][petice[0]]=dvojke[0];
    int sol=0;
    for (int i=0; i<n; ++i) {
        for (int j=0; j<=i; ++j) {
            if (i==0 && j==0) continue;
            for (int l=0; l<=zbr_petice; ++l) {
                if (i>0) dp[1][j][l]=max(dp[1][j][l], dp[0][j][l]);
                if (i>0 && j>0 && l>=petice[i]) dp[1][j][l]=max(dp[1][j][l], dp[0][j-1][l-petice[i]]+dvojke[i]);
                //cout <<i<<" "<<j<<" "<<l<<" -> "<<dp[i][j][l]<<endl;
                dp[0][j][l]=dp[1][j][l];
            }
        }
    }
    for (int i=1; i<=zbr_petice; ++i) sol=max(sol, min(i, dp[0][k][i]));
    printf("%d", sol);
}

int main() {
    load();
    solve();
}


#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <cstring>

/*
3 1
1000000000000000000
800000000000000000
625
*/

using namespace std;

typedef long long llint;

const int INF=0x3f3f3f3f;
const int N=205;

int n, k, zbr_petice=0;
int dvojke[N], petice[N];
int dp[2][N][200*30];

void load() {
    scanf("%d %d", &n, &k);
    for (int i=0; i<n; ++i) {
        llint y;
        cin >>y;
        llint x=y;
        while (x%2==0) {
            dvojke[i]++;
            x/=2;
        }
        while (x%5==0) {
            petice[i]++;
            zbr_petice++;
            x/=5;
        }
        //cout <<"petice: "<<petice[i]<<"   "<<"dvojke: "<<dvojke[i]<<endl;
    }
    memset(dp, -1, sizeof dp);
}

void solve() {
    //cout <<rek(0, 0, 0)<<endl;
    dp[0][0][0]=0;
    dp[0][1][petice[0]]=dvojke[0];
    int sol=0;
    for (int i=0; i<n; ++i) {
        for (int j=0; j<=i; ++j) {
            if (i==0 && j==0) continue;
            for (int l=0; l<=zbr_petice; ++l) {
                if (i>0) dp[i%2][j][l]=max(dp[i%2][j][l], dp[!(i%2)][j][l]);
                if (i>0 && j>0 && l>=petice[i] && dp[!(i%2)][j-1][l-petice[i]]!=-1) dp[i%2][j][l]=max(dp[i%2][j][l], dp[!(i%2)][j-1][l-petice[i]]+dvojke[i]);
                //cout <<i<<" "<<j<<" "<<l<<" -> "<<dp[i%2][j][l]<<endl;
            }
        }
        /*for (int j=0; j<=i; ++j) {
        	for (int l=0; l<=zbr_petice; ++l) {
        		dp[0][j][l]=dp[1][j][l];
			}
		}*/
    }
    for (int i=1; i<=zbr_petice; ++i) sol=max(sol, min(i, dp[(n-1)%2][k][i]));
    printf("%d", sol);
}

int main() {
    load();
    solve();
}


#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <cstring>

using namespace std;

typedef long long llint;

const int INF=0x3f3f3f3f;
const int N=205;

int n, k, zbr_petice=0;
int dvojke[N], petice[N];
int dp[2][N][200*30];

void load() {
    scanf("%d %d", &n, &k);
    for (int i=0; i<n; ++i) {
        llint y;
        cin >>y;
        llint x=y;
        while (x%2==0) {
            dvojke[i]++;
            x/=2;
        }
        while (x%5==0) {
            petice[i]++;
            zbr_petice++;
            x/=5;
        }
    }
    memset(dp, -1, sizeof dp);
}

void solve() {
    //cout <<rek(0, 0, 0)<<endl;
    dp[0][0][0]=0;
    dp[0][1][petice[0]]=dvojke[0];
    int sol=0;
    for (int i=0; i<n; ++i) {
        for (int j=0; j<=i; ++j) {
            if (i==0 && j==0) continue;
            for (int l=0; l<=zbr_petice; ++l) {
                if (i>0) dp[1][j][l]=max(dp[1][j][l], dp[0][j][l]);
                if (i>0 && j>0 && l>=petice[i]) dp[1][j][l]=max(dp[1][j][l], dp[0][j-1][l-petice[i]]+dvojke[i]);
                //cout <<i<<" "<<j<<" "<<l<<" -> "<<dp[1][j][l]<<endl;
            }
        }
        for (int j=0; j<=i; ++j) {
        	for (int l=0; l<=zbr_petice; ++l) {
        		dp[0][j][l]=dp[1][j][l];
			}
		}
    }
    for (int i=1; i<=zbr_petice; ++i) sol=max(sol, min(i, dp[0][k][i]));
    printf("%d", sol);
}

int main() {
    load();
    solve();
}


#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <cstring>

using namespace std;

typedef long long llint;

const int INF=0x3f3f3f3f;
const int N=205;

int n, k, zbr_petice=0;
int dvojke[N], petice[N];
int dp[N][N][N*30];

void load() {
    scanf("%d %d", &n, &k);
    for (int i=0; i<n; ++i) {
        llint y;
        scanf("%l64d", &y);
        llint x=y;
        while (x%2==0) {
            dvojke[i]++;
            x/=2;
        }
        while (x%5==0) {
            petice[i]++;
            zbr_petice++;
            x/=5;
        }
    }
    memset(dp, -1, sizeof dp);
}

void solve() {
    //cout <<rek(0, 0, 0)<<endl;
    dp[0][0][0]=0;
    dp[0][1][petice[0]]=dvojke[0];
    int sol=0;
    for (int i=0; i<n; ++i) {
        for (int j=0; j<=i; ++j) {
            if (i==0 && j==0) continue;
            for (int l=0; l<=zbr_petice; ++l) {
                if (i>0) dp[i][j][l]=max(dp[i][j][l], dp[i-1][j][l]);
                if (i>0 && j>0 && l>=petice[i]) dp[i][j][l]=max(dp[i][j][l], dp[i-1][j-1][l-petice[i]]+dvojke[i]);
                //cout <<i<<" "<<j<<" "<<l<<" -> "<<dp[i][j][l]<<endl;
            }
        }
    }
    for (int i=1; i<=zbr_petice; ++i) sol=max(sol, min(i, dp[n-1][k][i]));
    printf("%d", sol);
}

int main() {
    load();
    solve();
}


#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <cstring>

/*
3 1
1000000000000000000
800000000000000000
625

5 3
15
16
3
25
9
*/

using namespace std;

#define DEBUG 0

typedef long long llint;

const int INF=0x3f3f3f3f;
const int N=205;

int n, k, zbr_petice=0;
int dvojke[N], petice[N];
int dp[2][N][200*30];

void load() {
    scanf("%d %d", &n, &k);
    for (int i=0; i<n; ++i) {
        llint y;
        cin >>y;
        llint x=y;
        while (x%2==0) {
            dvojke[i]++;
            x/=2;
        }
        while (x%5==0) {
            petice[i]++;
            zbr_petice++;
            x/=5;
        }
        #if DEBUG
            cout <<"petice: "<<petice[i]<<"   "<<"dvojke: "<<dvojke[i]<<endl;
        #endif // DEBUG
    }
    memset(dp, -1, sizeof dp);
}

void solve() {
    //cout <<rek(0, 0, 0)<<endl;
    dp[0][0][0]=0;
    dp[0][1][petice[0]]=dvojke[0];
    int sol=0;
    for (int i=0; i<n; ++i) {
        for (int j=0; j<=min(i+1, k); ++j) {
            if (i==0 && j==0) continue;
            for (int l=0; l<=zbr_petice; ++l) {
                if (j==0 && l==0) dp[i%2][j][l]=0;
                if (i>0) dp[i%2][j][l]=max(dp[i%2][j][l], dp[!(i%2)][j][l]);
                if (i>0 && j>0 && l>=petice[i] && dp[!(i%2)][j-1][l-petice[i]]!=-1) dp[i%2][j][l]=max(dp[i%2][j][l], dp[!(i%2)][j-1][l-petice[i]]+dvojke[i]);
                //cout <<i<<" "<<j<<" "<<l<<" -> "<<dp[i%2][j][l]<<endl;
            }
        }
        /*for (int j=0; j<=i; ++j) {
        	for (int l=0; l<=zbr_petice; ++l) {
        		dp[0][j][l]=dp[1][j][l];
			}
		}*/
    }
    for (int i=1; i<=zbr_petice; ++i) sol=max(sol, min(i, dp[(n-1)%2][k][i]));
    printf("%d", sol);
}

int main() {
    load();
    solve();
}


#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <cstring>

using namespace std;

typedef long long llint;

const int INF=0x3f3f3f3f;
const int N=205;

int n, k, zbr_petice=0;
int dvojke[N], petice[N];
int dp[2][N][200*30];

void load() {
    scanf("%d %d", &n, &k);
    for (int i=0; i<n; ++i) {
        llint y;
        cin >>y;
        llint x=y;
        while (x%2==0) {
            dvojke[i]++;
            x/=2;
        }
        while (x%5==0) {
            petice[i]++;
            zbr_petice++;
            x/=5;
        }
    }
    memset(dp, -1, sizeof dp);
}

void solve() {
    //cout <<rek(0, 0, 0)<<endl;
    dp[0][0][0]=0;
    dp[0][1][petice[0]]=dvojke[0];
    int sol=0;
    for (int i=0; i<n; ++i) {
        for (int j=0; j<=i; ++j) {
            if (i==0 && j==0) continue;
            for (int l=0; l<=zbr_petice; ++l) {
                if (i>0) dp[1][j][l]=max(dp[1][j][l], dp[0][j][l]);
                if (i>0 && j>0 && l>=petice[i]) dp[1][j][l]=max(dp[1][j][l], dp[0][j-1][l-petice[i]]+dvojke[i]);
                //cout <<i<<" "<<j<<" "<<l<<" -> "<<dp[i][j][l]<<endl;
            }
        }
        for (int j=0; j<=i; ++j) {
        	for (int l=0; l<=zbr_petice; ++l) {
        		dp[1][j][l]=dp[0][j][l];
			}
		}
    }
    for (int i=1; i<=zbr_petice; ++i) sol=max(sol, min(i, dp[0][k][i]));
    printf("%d", sol);
}

int main() {
    load();
    solve();
}


#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <cstring>

/*
3 1
1000000000000000000
800000000000000000
625
*/

using namespace std;

typedef long long llint;

const int INF=0x3f3f3f3f;
const int N=205;

int n, k, zbr_petice=0;
int dvojke[N], petice[N];
int dp[2][N][200*30];

void load() {
    scanf("%d %d", &n, &k);
    for (int i=0; i<n; ++i) {
        llint y;
        cin >>y;
        llint x=y;
        while (x%2==0) {
            dvojke[i]++;
            x/=2;
        }
        while (x%5==0) {
            petice[i]++;
            zbr_petice++;
            x/=5;
        }
        //cout <<"petice: "<<petice[i]<<"   "<<"dvojke: "<<dvojke[i]<<endl;
    }
    memset(dp, -1, sizeof dp);
}

void solve() {
    //cout <<rek(0, 0, 0)<<endl;
    dp[0][0][0]=0;
    dp[0][1][petice[0]]=dvojke[0];
    int sol=0;
    for (int i=0; i<n; ++i) {
        for (int j=0; j<=i; ++j) {
            if (i==0 && j==0) continue;
            for (int l=0; l<=zbr_petice; ++l) {
                if (i>0) dp[i%2][j][l]=max(dp[i%2][j][l], dp[!(i%2)][j][l]);
                if (i>0 && j>0 && l>=petice[i] && dp[!(i%2)][j-1][l-petice[i]]!=-1) dp[i%2][j][l]=max(dp[i%2][j][l], dp[!(i%2)][j-1][l-petice[i]]+dvojke[i]);
                //cout <<i<<" "<<j<<" "<<l<<" -> "<<dp[i%2][j][l]<<endl;
            }
        }
        /*for (int j=0; j<=i; ++j) {
        	for (int l=0; l<=zbr_petice; ++l) {
        		dp[0][j][l]=dp[1][j][l];
			}
		}*/
    }
    for (int i=1; i<=zbr_petice; ++i) sol=max(sol, min(i, dp[i%2][k][i]));
    printf("%d", sol);
}

int main() {
    load();
    solve();
}


#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <cstring>

/*
3 1
1000000000000000000
800000000000000000
625

5 3
15
16
3
25
9
*/

using namespace std;

#define DEBUG 0

typedef long long llint;

const int INF=0x3f3f3f3f;
const int N=205;

int n, k, zbr_petice=0;
int dvojke[N], petice[N];
int dp[2][N][200*30];

void load() {
    scanf("%d %d", &n, &k);
    for (int i=0; i<n; ++i) {
        llint y;
        cin >>y;
        llint x=y;
        while (x%2==0) {
            dvojke[i]++;
            x/=2;
        }
        while (x%5==0) {
            petice[i]++;
            zbr_petice++;
            x/=5;
        }
        #if DEBUG
            cout <<"petice: "<<petice[i]<<"   "<<"dvojke: "<<dvojke[i]<<endl;
        #endif // DEBUG
    }
    memset(dp, -1, sizeof dp);
}

void solve() {
    //cout <<rek(0, 0, 0)<<endl;
    dp[0][0][0]=0;
    dp[0][1][petice[0]]=dvojke[0];
    int sol=0;
    for (int i=0; i<n; ++i) {
        for (int j=0; j<=min(i+1, k); ++j) {
            if (i==0 && j==0) continue;
            for (int l=0; l<=zbr_petice; ++l) {
                if (j==0 && l==0) dp[i%2][j][l]=0;
                if (i>0) dp[i%2][j][l]=max(dp[i%2][j][l], dp[!(i%2)][j][l]);
                if (i>0 && j>0 && l>=petice[i] && dp[!(i%2)][j-1][l-petice[i]]!=-1) dp[i%2][j][l]=max(dp[i%2][j][l], dp[!(i%2)][j-1][l-petice[i]]+dvojke[i]);
                //cout <<i<<" "<<j<<" "<<l<<" -> "<<dp[i%2][j][l]<<endl;
            }
        }
        /*for (int j=0; j<=i; ++j) {
        	for (int l=0; l<=zbr_petice; ++l) {
        		dp[0][j][l]=dp[1][j][l];
			}
		}*/
    }
    int bzvz=1;
    for (int i=1; i<=zbr_petice; ++i) sol=max(sol, min(i, dp[(n-1)%2][k][i]));
    printf("%d", sol);
}

int main() {
    load();
    solve();
}