#include <bits/stdc++.h>
using namespace std;
int a[100005];
int n, k;
bool cmp(int a, int b) { return a % 10 > b % 10; }
int main() {
  cin >> n >> k;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  sort(a, a + n, cmp);
  int st = 0;
  while (st < n && k >= 0) {
    if (a[st] == 100) break;
    int cha = 10 - a[st] % 10;
    if (k < cha) break;
    k -= cha;
    a[st] += cha;
    st++;
  }
  if (k) {
    for (int i = 0; i < n; ++i) {
      a[i] += k;
      if (a[i] >= 100) {
        k = a[i] - 100;
        a[i] = 100;
      } else
        k = 0;
      if (k <= 0) break;
    }
  }
  int ans = 0;
  for (int i = 0; i < n; ++i) ans += a[i] / 10;
  cout << ans << endl;
  return 0;
}
