#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
bool comp(int a, int b) { return (a % 10 > b % 10); }
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, k;
  cin >> n >> k;
  int a[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  sort(a, a + n, comp);
  for (int i = 0; i < n; i++) {
    int x = 9 - (a[i] % 10);
    x++;
    if (a[i] == 100) continue;
    if (k >= x) {
      a[i] = a[i] + x;
      k = k - x;
    }
    if (k == 0) break;
  }
  sort(a, a + n);
  int ans = 0;
  for (int i = 0; i < n; i++) {
    while (a[i] < 100 && k > 9) {
      if (k > 9) {
        a[i] += 10;
        k -= 10;
      }
    }
    ans = ans + a[i] / 10;
  }
  cout << ans;
  return 0;
}
