#include <bits/stdc++.h>
using namespace std;
int n, k, a[100010] = {}, t[10] = {}, sum = 0, ans = 0;
bool cmp(int a, int b) { return (a % 10) > (b % 10); }
int main() {
  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++) {
    if (k - (10 - a[i] % 10) >= 0) {
      k -= 10 - a[i] % 10;
      a[i] += 10 - (a[i] % 10);
    }
    ans += a[i] / 10;
  }
  ans += k / 10;
  cout << min(ans, n * 10);
}
