#include <bits/stdc++.h>
using namespace std;
bool cmp(long long x, long long y) {
  long long a, b;
  a = x % 10;
  b = y % 10;
  return a > b;
}
int main() {
  long long n, k, a[100100], x, ans = 0;
  cin >> n >> k;
  for (int i = 0; i < n; i++) cin >> a[i];
  sort(a, a + n, cmp);
  for (int i = 0; i < n; i++) {
    x = min(min(100 - a[i], 10 - a[i] % 10), k);
    a[i] += x;
    k -= x;
    ans += a[i] / 10;
  }
  for (int i = 0; i < n; i++) {
    x = min(100 - a[i], k);
    k -= x;
    ans += x / 10;
  }
  cout << ans << endl;
  return 0;
}
