#include <bits/stdc++.h>
using namespace std;
int a[111111], b[111111];
bool comp(int x, int y) { return (x % 10) > (y % 10); }
int main() {
  int n, m, ans = 0;
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    ans += a[i] / 10;
  }
  sort(a, a + n, comp);
  int sum = n * 100;
  int i;
  for (i = 0; i < n; i++) {
    if (a[i] % 10 == 0) {
      sum -= a[i];
      continue;
    }
    if (m < 10 - a[i] % 10) break;
    m -= 10 - a[i] % 10;
    sum -= a[i] + 10 - a[i] % 10;
    ans++;
  }
  if (i < n)
    cout << ans << endl;
  else {
    cout << ans + min(sum, m) / 10 << endl;
  }
  return 0;
}
