#include <bits/stdc++.h>
using namespace std;
int n, k, a[100002], ans;
int main() {
  cin >> n >> k;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    ans += a[i] / 10;
    a[i] %= 10;
  }
  sort(a + 1, a + n + 1);
  for (int i = n; i >= 1; i--)
    if (k >= 10 - a[i]) ans++, k -= 10 - a[i];
  ans += k / 10;
  cout << min(n * 10, ans);
}
