#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 1;
int a[maxn], ans[maxn];
bool cmp(int x, int y) { return x % 10 > y % 10; }
int main() {
  int n, k;
  cin >> n >> k;
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  sort(a + 1, a + n + 1, cmp);
  int ans = 0, leave = 0;
  for (int i = 1; i <= n; i++) {
    if (a[i] == 100) continue;
    if (k - (10 - a[i] % 10) >= 0) {
      k -= (10 - a[i] % 10);
      a[i] = a[i] + 10 - a[i] % 10;
    }
  }
  for (int i = 1; i <= n; i++) {
    ans += a[i] / 10;
    leave += 100 - a[i];
  }
  if (k && k >= leave)
    ans += leave / 10;
  else if (k)
    ans += k / 10;
  cout << ans << endl;
  return 0;
}
