#include <iostream>
using namespace std;
int main()
{
int k, n, num, m, i, suma=0, scif, nr=0;
cout << "k= "; cin >> k;
cout << "n= "; cin >> n;
cout << "introdu " << n << " numere naturale: " << endl;
for (i=1; i<=n; ++i)
{
cin >> num;
scif=0; m=num;
while (m)
{
scif=scif+m%10;
m=m/10;
}
if (scif%k==0)
{suma=suma+num; ++nr;}
}
if (nr==0) cout << "nu exista ...";
else cout << suma;
}