#include <bits/stdc++.h>
using namespace std;
bool cmp(int a, int b) { return (a % 10) > (b % 10); }
int main() {
  ios_base::sync_with_stdio(false);
  int n, a[100010], k;
  cin >> n >> k;
  for (int i = 1; i <= n; i++) cin >> a[i];
  sort(a + 1, a + n + 1, cmp);
  int i = 1;
  for (int i = 1; i <= n; i++) {
    int tmp = 10 - (a[i] % 10);
    if (tmp > k) break;
    if (a[i] + tmp <= 100) a[i] = a[i] + tmp, k -= tmp;
  }
  for (int i = 1; i <= n; i++) {
    while (a[i] + 10 <= 100 && k >= 10) k -= 10, a[i] += 10;
  }
  int res = 0;
  for (int i = 1; i <= n; i++) res += (a[i] / 10);
  cout << res << '\n';
  return 0;
}
