#include <bits/stdc++.h>
using namespace std;
const int MAX = 1e5 + 1;
int n, k, a[MAX], b, res;
bool cmp(int a, int b) {
  int aa = 10 - (a % 10);
  int bb = 10 - (b % 10);
  return aa < bb;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n >> k;
  for (int i = 1; i <= n; ++i) cin >> a[i];
  sort(a + 1, a + 1 + n, cmp);
  for (int i = 1; i <= n; ++i) {
    if (k >= (10 - (a[i] % 10)) % 10) {
      k -= (10 - (a[i] % 10)) % 10;
      a[i] += (10 - (a[i] % 10)) % 10;
    }
  }
  for (int i = 1; i <= n; ++i) {
    b = min(k / 10, (100 - a[i]) / 10);
    k -= b * 10;
    a[i] += b * 10;
    res += a[i] / 10;
  }
  cout << res;
  return 0;
}
