#include <bits/stdc++.h>
using namespace std;
const int Nmax = 200303;
int a[Nmax], b[Nmax];
bool cmp(int x, int y) { return (x % 10 > y % 10); }
int main() {
  int n, k;
  cin >> n >> k;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  sort(a + 1, a + n + 1, cmp);
  for (int i = 1; i <= n; i++) {
    if (k <= 0) break;
    if (a[i] == 100) continue;
    int t = min(10 - a[i] % 10, k);
    a[i] += t;
    k -= t;
  }
  long long sum = 0;
  int temp = 0;
  for (int i = 1; i <= n; i++) {
    sum += (a[i] / 10);
    a[i] = 10 - (a[i] / 10);
    temp += a[i];
  }
  sum += min(temp, (k / 10));
  cout << sum << endl;
  return 0;
}
