For this we need implement user_login hook and then we check the last access field.
use Drupal\user\Entity\User;
/**
* Implements hook_user_login().
*/
function mymodule_user_login(User $user) {
if (empty($user->getLastAccessedTime())) {
// Do something here.
}
}